diff --git a/src/app/admin/page.tsx b/src/app/admin/page.tsx
index df840ee..22b3044 100644
--- a/src/app/admin/page.tsx
+++ b/src/app/admin/page.tsx
@@ -1,6 +1,7 @@
'use client';
import { useState, useEffect, useRef, useCallback } from 'react';
+import { formatDisplayDate, formatDisplayDateTime } from '@/lib/date';
type Image = { id: number; filename: string; data: string; category: string; room_id: number | null; location_target: string; uploaded_at: string };
type Slide = { id: number; title: string; subtitle: string; image_url: string | null; image_id: number | null; active: boolean; sort_order: number };
@@ -1168,7 +1169,7 @@ function TripsSection({ onToast }: { onToast: (msg: string, type: string) => voi
{t.room_name || 'No room assigned'}
- In: {new Date(t.check_in).toLocaleDateString()} · Out: {new Date(t.check_out).toLocaleDateString()}
+ In: {formatDisplayDate(t.check_in)} · Out: {formatDisplayDate(t.check_out)}
{t.status.replace('_', ' ')}
@@ -1282,7 +1283,7 @@ function MessagesSection({ onToast }: { onToast: (msg: string, type: string) =>
{m.sender_role === 'admin' ? 'Staff' : 'Guest'}
{m.message}
-
{new Date(m.created_at).toLocaleString('en-US', { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' })}
+
{formatDisplayDateTime(m.created_at)}
))}
@@ -1975,7 +1976,7 @@ function UsersSection({ onToast }: { onToast: (msg: string, type: string) => voi
{u.first_name || ''} {u.last_name || ''} {u.email ? `• ${u.email}` : ''} {u.country ? `• ${u.country}` : ''}
- {u.terms_accepted_at ? `• Terms: ${new Date(u.terms_accepted_at).toLocaleDateString()}` : '• Terms not accepted'}
+ {u.terms_accepted_at ? `• Terms: ${formatDisplayDate(u.terms_accepted_at)}` : '• Terms not accepted'}
{u.comments_disabled ? '• Comments disabled' : ''}
@@ -2005,7 +2006,7 @@ function UsersSection({ onToast }: { onToast: (msg: string, type: string) => voi
setEditing({ ...editing, comments_disabled: v })} />
{editing.terms_accepted_at && (
- Terms accepted: {new Date(editing.terms_accepted_at).toLocaleString()}
+ Terms accepted: {formatDisplayDateTime(editing.terms_accepted_at)}
)}
diff --git a/src/app/rooms/page.tsx b/src/app/rooms/page.tsx
index b327a17..aa515a3 100644
--- a/src/app/rooms/page.tsx
+++ b/src/app/rooms/page.tsx
@@ -1,6 +1,7 @@
'use client';
import { useEffect, useState, useRef } from 'react';
+import { formatDisplayDate } from '@/lib/date';
interface Room {
id: number;
@@ -398,7 +399,7 @@ export default function RoomsPage() {
{c.first_name}{c.last_initial ? ` ${c.last_initial}.` : ''}
- {new Date(c.created_at).toLocaleDateString()}
+ {formatDisplayDate(c.created_at)}
{c.text}
diff --git a/src/app/user/page.tsx b/src/app/user/page.tsx
index e0c57ca..12a2b2c 100644
--- a/src/app/user/page.tsx
+++ b/src/app/user/page.tsx
@@ -2,6 +2,7 @@
import { useEffect, useState, useRef } from 'react';
import { useRouter } from 'next/navigation';
+import { formatDisplayDate, formatDisplayDateTime } from '@/lib/date';
interface Trip {
id: number;
@@ -170,7 +171,7 @@ export default function UserPage() {
Welcome to Hosteria La Huasca!
- Your room{activeTrip.room_name ? ` (${activeTrip.room_name})` : ''} is ready. Check-out: {new Date(activeTrip.check_out).toLocaleDateString('en-US', { weekday: 'long', month: 'short', day: 'numeric' })}
+ Your room{activeTrip.room_name ? ` (${activeTrip.room_name})` : ''} is ready. Check-out: {formatDisplayDate(activeTrip.check_out, { weekday: 'long', month: 'short', day: 'numeric' })}
@@ -183,11 +184,11 @@ export default function UserPage() {
Check-in
-
{new Date(upcomingTrip.check_in).toLocaleDateString('en-US', { weekday: 'short', month: 'short', day: 'numeric' })}
+
{formatDisplayDate(upcomingTrip.check_in, { weekday: 'short', month: 'short', day: 'numeric' })}
Check-out
-
{new Date(upcomingTrip.check_out).toLocaleDateString('en-US', { weekday: 'short', month: 'short', day: 'numeric' })}
+
{formatDisplayDate(upcomingTrip.check_out, { weekday: 'short', month: 'short', day: 'numeric' })}
{upcomingTrip.room_name && (
@@ -237,7 +238,7 @@ export default function UserPage() {
{m.message}
- {new Date(m.created_at).toLocaleString('en-US', { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' })}
+ {formatDisplayDateTime(m.created_at)}