feat: update Daily management features and enhance date handling

- Marked the calendar/history view of dailies as completed in the TODO list.
- Improved date formatting in `formatDateForAPI` to avoid timezone issues.
- Added `getDailyDates` method in `DailyClient` and `DailyService` to retrieve all dates with dailies.
- Enhanced `POST` route to robustly parse date input for better error handling.
- Integrated daily dates loading in `DailyPageClient` for calendar display.
This commit is contained in:
Julien Froidefond
2025-09-15 18:21:48 +02:00
parent cf2e360ce9
commit 936e0306fc
8 changed files with 381 additions and 46 deletions

View File

@@ -123,10 +123,13 @@ export class DailyClient {
}
/**
* Formate une date pour l'API
* Formate une date pour l'API (évite les décalages timezone)
*/
formatDateForAPI(date: Date): string {
return date.toISOString().split('T')[0]; // YYYY-MM-DD
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`; // YYYY-MM-DD
}
/**
@@ -147,6 +150,14 @@ export class DailyClient {
return this.getDailyView(date);
}
/**
* Récupère toutes les dates qui ont des dailies
*/
async getDailyDates(): Promise<string[]> {
const response = await httpClient.get<{ dates: string[] }>('/daily/dates');
return response.dates;
}
}
// Instance singleton du client