- Refactor Profile and Login screens to use AuthContext for user data

- Enhance RequestPermitModal with multiple time-off types and validation
- Implement CalendarWidget for visualizing time-off requests
- Improve API error handling and token management
- Add utility functions for consistent date and time formatting
- Clean up unused mock data and update types
This commit is contained in:
2025-12-10 18:21:08 +01:00
parent 49b6ecadb2
commit b9807f6cc2
13 changed files with 503 additions and 343 deletions

21
utils/dateTime.ts Normal file
View File

@ -0,0 +1,21 @@
/**
* Trasforma una data da "YYYY-MM-DD" a "DD/MM/YYYY"
* @param dateStr stringa data in formato ISO "YYYY-MM-DD"
* @returns stringa formattata "DD/MM/YYYY"
*/
export const formatDate = (dateStr: string | null | undefined): string => {
if (!dateStr) return '';
const [year, month, day] = dateStr.split('-');
return `${day}/${month}/${year}`;
};
/**
* Trasforma un'ora da "HH:MM:SS" a "HH:MM"
* @param timeStr stringa ora in formato "HH:MM:SS"
* @returns stringa formattata "HH:MM"
*/
export const formatTime = (timeStr: string | null | undefined): string => {
if (!timeStr) return '';
const [hours, minutes] = timeStr.split(':');
return `${hours}:${minutes}`;
};