Fix homepage time event

pull/1/head
Made Baruna 2022-04-17 23:47:18 +07:00
parent c55a1bd43a
commit dbcc087995
2 changed files with 3 additions and 4 deletions

View File

@ -10,7 +10,7 @@
const dispatch = createEventDispatcher();
const promoted = ['venti', 'sucrose', 'yun_jin'];
const promoted = ['kamisato_ayato', 'venti'];
let current = 0;
async function change(index) {

View File

@ -36,13 +36,12 @@
if (start.isBefore(now) && end.isAfter(now)) {
const diff = end.diff(now);
const timeLeft = dayjs.duration(diff);
event.time = diff > 86400000 ? `${timeLeft.asDays().toFixed(0)}d ${timeLeft.hours()}h` : `${timeLeft.hours()}h`;
event.time = diff > 86400000 ? timeLeft.format('D[d] H[h]') : timeLeft.format('H[h]');
current = [...current, event];
} else if (start.isAfter(now)) {
const diff = start.diff(now);
const timeUpcoming = dayjs.duration(diff);
event.time =
diff > 86400000 ? `${timeUpcoming.asDays().toFixed(0)}d ${timeUpcoming.hours()}h` : `${timeUpcoming.hours()}h`;
event.time = diff > 86400000 ? timeUpcoming.format('D[d] H[h]') : timeUpcoming.format('H[h]');
upcoming = [...upcoming, event];
}
}