theming, date, time localisation, additional features, seeding initial cleanup
This commit is contained in:
+20
-2
@@ -18,7 +18,7 @@ export function formatTime(time: string): string {
|
||||
}
|
||||
|
||||
export function formatDate(date: string): string {
|
||||
return new Date(date).toLocaleDateString('en-US', {
|
||||
return new Date(date).toLocaleDateString('en-IE', {
|
||||
weekday: 'long',
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
@@ -40,18 +40,36 @@ export function isWithinBookingWindow(date: string): boolean {
|
||||
return bookingDate >= today && bookingDate <= maxDate;
|
||||
}
|
||||
|
||||
// Ireland localization - Monday as first day of week
|
||||
export function getWeekDays(): Array<{ value: number; label: string }> {
|
||||
return [
|
||||
{ value: 0, label: 'Sunday' },
|
||||
{ value: 1, label: 'Monday' },
|
||||
{ value: 2, label: 'Tuesday' },
|
||||
{ value: 3, label: 'Wednesday' },
|
||||
{ value: 4, label: 'Thursday' },
|
||||
{ value: 5, label: 'Friday' },
|
||||
{ value: 6, label: 'Saturday' },
|
||||
{ value: 0, label: 'Sunday' },
|
||||
];
|
||||
}
|
||||
|
||||
// Convert JavaScript's getDay() (0=Sunday) to Irish standard (0=Monday)
|
||||
export function getIrishDayOfWeek(date: Date): number {
|
||||
const jsDay = date.getDay();
|
||||
return jsDay === 0 ? 6 : jsDay - 1; // Sunday becomes 6, Monday becomes 0
|
||||
}
|
||||
|
||||
// Convert Irish day index (0=Monday) back to JavaScript's getDay() format
|
||||
export function getJavaScriptDayOfWeek(irishDay: number): number {
|
||||
return irishDay === 6 ? 0 : irishDay + 1; // 6 becomes Sunday (0), others shift up
|
||||
}
|
||||
|
||||
// Get day name using Irish week start (0=Monday)
|
||||
export function getIrishDayName(irishDayIndex: number): string {
|
||||
const days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
|
||||
return days[irishDayIndex];
|
||||
}
|
||||
|
||||
export function generateTimeSlots(startHour: number, endHour: number): string[] {
|
||||
const slots = [];
|
||||
for (let hour = startHour; hour < endHour; hour++) {
|
||||
|
||||
Reference in New Issue
Block a user