mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-09 00:08:18 +00:00
Refine booking flow
This commit is contained in:
@@ -13,9 +13,17 @@ export const formatDate = (date: string | Date, formatStr: string = 'MMM dd, yyy
|
||||
};
|
||||
|
||||
export const formatDateTime = (date: string | Date): string => {
|
||||
return format(new Date(date), 'MMM dd, yyyy HH:mm');
|
||||
return format(new Date(date), 'MMM dd, yyyy h:mm a');
|
||||
};
|
||||
|
||||
export const formatTime = (date: string | Date): string => {
|
||||
return format(new Date(date), 'HH:mm');
|
||||
return format(new Date(date), 'h:mm a');
|
||||
};
|
||||
|
||||
export const getTimePeriod = (date: string | Date): string => {
|
||||
const hour = new Date(date).getHours();
|
||||
if (hour >= 5 && hour < 12) return 'Morning';
|
||||
if (hour >= 12 && hour < 17) return 'Afternoon';
|
||||
if (hour >= 17 && hour < 21) return 'Evening';
|
||||
return 'Night';
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user