fix: use Ecuador timezone (GMT-5) for all date displays across the app

This commit is contained in:
2026-06-29 23:53:58 -05:00
parent 7b72994d4a
commit f9c8d48631
3 changed files with 12 additions and 9 deletions
+5 -4
View File
@@ -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
<div style={{ fontSize: '13px', color: C.textLight }}>{t.room_name || 'No room assigned'}</div>
</div>
<div style={{ fontSize: '13px', color: C.text }}>
<strong>In:</strong> {new Date(t.check_in).toLocaleDateString()} · <strong>Out:</strong> {new Date(t.check_out).toLocaleDateString()}
<strong>In:</strong> {formatDisplayDate(t.check_in)} · <strong>Out:</strong> {formatDisplayDate(t.check_out)}
</div>
<Badge color={t.status === 'confirmed' ? C.success : t.status === 'checked_in' ? '#1976d2' : t.status === 'cancelled' ? C.danger : '#666'}>{t.status.replace('_', ' ')}</Badge>
<div style={{ display: 'flex', gap: '8px' }}>
@@ -1282,7 +1283,7 @@ function MessagesSection({ onToast }: { onToast: (msg: string, type: string) =>
<div style={{ maxWidth: '70%', padding: '10px 14px', borderRadius: 12, background: m.sender_role === 'admin' ? C.gold : '#f0f0f0', color: m.sender_role === 'admin' ? '#fff' : C.navy }}>
<div style={{ fontSize: '12px', fontWeight: 500, marginBottom: '4px' }}>{m.sender_role === 'admin' ? 'Staff' : 'Guest'}</div>
<div style={{ fontSize: '14px' }}>{m.message}</div>
<div style={{ fontSize: '11px', opacity: 0.7, marginTop: '4px' }}>{new Date(m.created_at).toLocaleString('en-US', { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' })}</div>
<div style={{ fontSize: '11px', opacity: 0.7, marginTop: '4px' }}>{formatDisplayDateTime(m.created_at)}</div>
</div>
</div>
))}
@@ -1975,7 +1976,7 @@ function UsersSection({ onToast }: { onToast: (msg: string, type: string) => voi
</div>
<div style={{ fontSize: 12, color: C.textLight }}>
{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' : ''}
</div>
</div>
@@ -2005,7 +2006,7 @@ function UsersSection({ onToast }: { onToast: (msg: string, type: string) => voi
<Tgl label="Disable comments" checked={editing.comments_disabled || false} onChange={(v: boolean) => setEditing({ ...editing, comments_disabled: v })} />
{editing.terms_accepted_at && (
<div style={{ fontSize: 12, color: C.textLight }}>
Terms accepted: {new Date(editing.terms_accepted_at).toLocaleString()}
Terms accepted: {formatDisplayDateTime(editing.terms_accepted_at)}
</div>
)}
</div>
+2 -1
View File
@@ -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}.` : ''}
</strong>
<span style={{ fontSize: '12px', color: '#777' }}>
{new Date(c.created_at).toLocaleDateString()}
{formatDisplayDate(c.created_at)}
</span>
</div>
<p style={{ margin: 0, color: '#555', fontSize: '14px' }}>{c.text}</p>
+5 -4
View File
@@ -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!
</p>
<p style={{ margin: '0', opacity: 0.9 }}>
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' })}
</p>
</div>
</Section>
@@ -183,11 +184,11 @@ export default function UserPage() {
<div style={{ display: 'flex', gap: '2rem', flexWrap: 'wrap', marginBottom: '1rem' }}>
<div>
<div style={{ fontSize: '12px', color: warm, textTransform: 'uppercase', letterSpacing: '0.05em' }}>Check-in</div>
<div style={{ fontSize: '18px', fontWeight: 600, color: navy }}>{new Date(upcomingTrip.check_in).toLocaleDateString('en-US', { weekday: 'short', month: 'short', day: 'numeric' })}</div>
<div style={{ fontSize: '18px', fontWeight: 600, color: navy }}>{formatDisplayDate(upcomingTrip.check_in, { weekday: 'short', month: 'short', day: 'numeric' })}</div>
</div>
<div>
<div style={{ fontSize: '12px', color: warm, textTransform: 'uppercase', letterSpacing: '0.05em' }}>Check-out</div>
<div style={{ fontSize: '18px', fontWeight: 600, color: navy }}>{new Date(upcomingTrip.check_out).toLocaleDateString('en-US', { weekday: 'short', month: 'short', day: 'numeric' })}</div>
<div style={{ fontSize: '18px', fontWeight: 600, color: navy }}>{formatDisplayDate(upcomingTrip.check_out, { weekday: 'short', month: 'short', day: 'numeric' })}</div>
</div>
{upcomingTrip.room_name && (
<div>
@@ -237,7 +238,7 @@ export default function UserPage() {
</div>
<div style={{ fontSize: '14px' }}>{m.message}</div>
<div style={{ fontSize: '11px', opacity: 0.7, marginTop: '0.25rem' }}>
{new Date(m.created_at).toLocaleString('en-US', { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' })}
{formatDisplayDateTime(m.created_at)}
</div>
</div>
</div>