working leantime widget 130

This commit is contained in:
Alma 2025-04-12 23:19:05 +02:00
parent 98bf1cdbf8
commit b9a6ce3748

View File

@ -144,7 +144,8 @@ export function Flow() {
// Update the TaskDate component to handle dates better
const TaskDate = ({ task }: { task: TaskWithDate }) => {
if (!task.validDate) {
const dateStr = task.dateToFinish;
if (!dateStr || dateStr === '0000-00-00 00:00:00') {
return (
<>
<span className="text-xs text-gray-600 font-medium">NO</span>
@ -153,13 +154,18 @@ export function Flow() {
);
}
const today = new Date();
today.setHours(0, 0, 0, 0);
const isPastDue = task.validDate < today;
try {
const month = task.validDate.toLocaleString('fr-FR', { month: 'short' }).toUpperCase();
const day = task.validDate.getDate();
const date = new Date(dateStr);
if (isNaN(date.getTime())) {
throw new Error('Invalid date');
}
const today = new Date();
today.setHours(0, 0, 0, 0);
const isPastDue = date < today;
const month = date.toLocaleString('fr-FR', { month: 'short' }).toUpperCase();
const day = date.getDate();
return (
<>