mirror of
https://github.com/MadeBaruna/paimon-moe.git
synced 2025-03-14 11:43:52 +01:00
Fix todo today only when sunday
This commit is contained in:
parent
7cb32c5788
commit
a339329deb
2 changed files with 4 additions and 2 deletions
|
@ -15,6 +15,7 @@
|
|||
let numberFormat = Intl.NumberFormat();
|
||||
let adding = false;
|
||||
let todayOnly = false;
|
||||
let isSunday = false;
|
||||
let today = getCurrentDay();
|
||||
let summary = [];
|
||||
|
||||
|
@ -60,6 +61,7 @@
|
|||
|
||||
function toggleTodayOnly() {
|
||||
today = getCurrentDay();
|
||||
isSunday = today === 'sunday';
|
||||
todayOnly = !todayOnly;
|
||||
}
|
||||
|
||||
|
@ -87,7 +89,7 @@
|
|||
async function updateSummary() {
|
||||
summary = $todos.reduce((prev, current) => {
|
||||
for (const [id, amount] of Object.entries(current.resources)) {
|
||||
if (todayOnly && itemList[id].day && !itemList[id].day.includes(today)) continue;
|
||||
if (!isSunday && todayOnly && itemList[id].day && !itemList[id].day.includes(today)) continue;
|
||||
|
||||
if (prev[id] === undefined) {
|
||||
prev[id] = 0;
|
||||
|
|
|
@ -20,7 +20,7 @@ const weekdays = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'frida
|
|||
export const getCurrentDay = () => {
|
||||
const time = dayjs().utcOffset(timeOffset[get(server)]);
|
||||
let day = time.day();
|
||||
if (time.hour() > 0 && time.hour() < 4) {
|
||||
if (time.hour() >= 0 && time.hour() < 4) {
|
||||
day -= 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue