feat: add schedulers feature with task management
- Introduced SchedulersPage for managing scheduled tasks. - Implemented CreateTaskDialog for creating new scheduled tasks. - Added SchedulersHeader for filtering and searching tasks. - Created SchedulersTable to display scheduled tasks with actions. - Implemented loading and error states with SchedulersLoadingStates. - Added API service for task management in schedulers. - Enhanced date formatting utility to handle timezone. - Updated AppSidebar and AppRoutes to include SchedulersPage.
This commit is contained in:
@@ -112,4 +112,34 @@ export function formatDateDistanceToNow(
|
||||
}
|
||||
|
||||
return formatDistanceToNow(date, { addSuffix: true });
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a date string with timezone consideration
|
||||
* @param dateString - The date string to format
|
||||
* @param timezone - The target timezone (default: 'UTC')
|
||||
* @returns Formatted date string with timezone
|
||||
*/
|
||||
export function formatDateTime(dateString: string, timezone: string = 'UTC'): string {
|
||||
try {
|
||||
const date = new Date(dateString)
|
||||
|
||||
if (isNaN(date.getTime())) {
|
||||
return 'Invalid Date'
|
||||
}
|
||||
|
||||
const formatter = new Intl.DateTimeFormat('fr-FR', {
|
||||
timeZone: timezone,
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
hour12: false,
|
||||
})
|
||||
|
||||
return formatter.format(date)
|
||||
} catch {
|
||||
return 'Invalid Date'
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user