mirror of
https://github.com/wekan/wekan.git
synced 2026-01-31 13:45:17 +01:00
Verify that due background colors are correct also at My Due Cards.
Thanks to xet7 !
This commit is contained in:
parent
9399a0c545
commit
665c9b5e52
1 changed files with 29 additions and 0 deletions
|
|
@ -246,28 +246,57 @@ class CardDueDate extends CardDate {
|
|||
const theDate = this.date.get();
|
||||
const now = this.now.get();
|
||||
|
||||
// Debug logging for due date classes
|
||||
if (process.env.DEBUG === 'true') {
|
||||
console.log(`CardDueDate classes() - Card: "${this.data().title}", Due: ${theDate}, Now: ${now}, End: ${endAt}`);
|
||||
}
|
||||
|
||||
// If there's an end date and it's before the due date, task is completed early
|
||||
if (endAt && isBefore(endAt, theDate)) {
|
||||
classes += 'completed-early';
|
||||
if (process.env.DEBUG === 'true') {
|
||||
console.log(` -> completed-early (end date ${endAt} is before due date ${theDate})`);
|
||||
}
|
||||
}
|
||||
// If there's an end date, don't show due date status since task is completed
|
||||
else if (endAt) {
|
||||
classes += 'completed';
|
||||
if (process.env.DEBUG === 'true') {
|
||||
console.log(` -> completed (has end date ${endAt})`);
|
||||
}
|
||||
}
|
||||
// Due date logic based on current time
|
||||
else {
|
||||
const daysDiff = diff(theDate, now, 'days');
|
||||
if (process.env.DEBUG === 'true') {
|
||||
console.log(` -> daysDiff: ${daysDiff} (due: ${theDate}, now: ${now})`);
|
||||
}
|
||||
|
||||
if (daysDiff < 0) {
|
||||
// Due date is in the past - overdue
|
||||
classes += 'overdue';
|
||||
if (process.env.DEBUG === 'true') {
|
||||
console.log(` -> overdue (${Math.abs(daysDiff)} days past due)`);
|
||||
}
|
||||
} else if (daysDiff <= 1) {
|
||||
// Due today or tomorrow - due soon
|
||||
classes += 'due-soon';
|
||||
if (process.env.DEBUG === 'true') {
|
||||
console.log(` -> due-soon (due in ${daysDiff} days)`);
|
||||
}
|
||||
} else {
|
||||
// Due date is more than 1 day away - not due yet
|
||||
classes += 'not-due';
|
||||
if (process.env.DEBUG === 'true') {
|
||||
console.log(` -> not-due (due in ${daysDiff} days)`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (process.env.DEBUG === 'true') {
|
||||
console.log(` -> Final classes: "${classes}"`);
|
||||
}
|
||||
|
||||
return classes;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue