Fix the timeline time on the detail modal

- fix #34
pull/1/head
Made Baruna 2021-04-16 21:20:07 +07:00
parent e1c6b198d2
commit 5ed68715f3
3 changed files with 18 additions and 16 deletions

View File

@ -54,7 +54,7 @@ export const eventsData = [
end: '2021-04-23 04:00:00',
color: '#93E05A',
zoom: '170%',
url: 'https://genshin.mihoyo.com/en/news/detail/9741',
url: 'https://www.hoyolab.com/genshin/article/295568',
showOnHome: true,
},
],

View File

@ -5,12 +5,13 @@
import { onMount } from 'svelte';
export let event;
export let timeDifference;
let now = dayjs();
let now = dayjs().add(timeDifference, 'minute');
onMount(() => {
const interval = setInterval(() => {
now = dayjs();
now = dayjs().add(timeDifference, 'minute');
}, 1000);
return () => {

View File

@ -15,19 +15,6 @@
const { open: openModal } = getContext('simple-modal');
function openDetail(event) {
openModal(
DetailModal,
{
event,
},
{
closeButton: false,
styleWindow: { background: '#25294A', width: '600px' },
},
);
}
let loading = true;
let timelineContainer;
@ -50,6 +37,20 @@
let events = [];
let today = dayjs();
function openDetail(event) {
openModal(
DetailModal,
{
event,
timeDifference,
},
{
closeButton: false,
styleWindow: { background: '#25294A', width: '600px' },
},
);
}
function convertToDate(e, i) {
const start = dayjs(e.start, 'YYYY-MM-DD HH:mm:ss').subtract(timeDifferenceEvent, 'minute');
const end = dayjs(e.end, 'YYYY-MM-DD HH:mm:ss').subtract(timeDifferenceEvent, 'minute');