mirror of
https://github.com/MadeBaruna/paimon-moe.git
synced 2025-01-03 17:52:11 +01:00
Fix homepage time event
This commit is contained in:
parent
c55a1bd43a
commit
dbcc087995
2 changed files with 3 additions and 4 deletions
|
@ -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) {
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue