mirror of
https://github.com/MadeBaruna/paimon-moe.git
synced 2025-01-20 15:54:50 +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 dispatch = createEventDispatcher();
|
||||||
|
|
||||||
const promoted = ['venti', 'sucrose', 'yun_jin'];
|
const promoted = ['kamisato_ayato', 'venti'];
|
||||||
let current = 0;
|
let current = 0;
|
||||||
|
|
||||||
async function change(index) {
|
async function change(index) {
|
||||||
|
|
|
@ -36,13 +36,12 @@
|
||||||
if (start.isBefore(now) && end.isAfter(now)) {
|
if (start.isBefore(now) && end.isAfter(now)) {
|
||||||
const diff = end.diff(now);
|
const diff = end.diff(now);
|
||||||
const timeLeft = dayjs.duration(diff);
|
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];
|
current = [...current, event];
|
||||||
} else if (start.isAfter(now)) {
|
} else if (start.isAfter(now)) {
|
||||||
const diff = start.diff(now);
|
const diff = start.diff(now);
|
||||||
const timeUpcoming = dayjs.duration(diff);
|
const timeUpcoming = dayjs.duration(diff);
|
||||||
event.time =
|
event.time = diff > 86400000 ? timeUpcoming.format('D[d] H[h]') : timeUpcoming.format('H[h]');
|
||||||
diff > 86400000 ? `${timeUpcoming.asDays().toFixed(0)}d ${timeUpcoming.hours()}h` : `${timeUpcoming.hours()}h`;
|
|
||||||
upcoming = [...upcoming, event];
|
upcoming = [...upcoming, event];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue