fix: use Ecuador timezone (GMT-5) for all date displays across the app
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useState, useEffect, useRef, useCallback } from 'react';
|
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 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 };
|
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 style={{ fontSize: '13px', color: C.textLight }}>{t.room_name || 'No room assigned'}</div>
|
||||||
</div>
|
</div>
|
||||||
<div style={{ fontSize: '13px', color: C.text }}>
|
<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>
|
</div>
|
||||||
<Badge color={t.status === 'confirmed' ? C.success : t.status === 'checked_in' ? '#1976d2' : t.status === 'cancelled' ? C.danger : '#666'}>{t.status.replace('_', ' ')}</Badge>
|
<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' }}>
|
<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={{ 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: '12px', fontWeight: 500, marginBottom: '4px' }}>{m.sender_role === 'admin' ? 'Staff' : 'Guest'}</div>
|
||||||
<div style={{ fontSize: '14px' }}>{m.message}</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>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
@@ -1975,7 +1976,7 @@ function UsersSection({ onToast }: { onToast: (msg: string, type: string) => voi
|
|||||||
</div>
|
</div>
|
||||||
<div style={{ fontSize: 12, color: C.textLight }}>
|
<div style={{ fontSize: 12, color: C.textLight }}>
|
||||||
{u.first_name || ''} {u.last_name || ''} {u.email ? `• ${u.email}` : ''} {u.country ? `• ${u.country}` : ''}
|
{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' : ''}
|
{u.comments_disabled ? '• Comments disabled' : ''}
|
||||||
</div>
|
</div>
|
||||||
</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 })} />
|
<Tgl label="Disable comments" checked={editing.comments_disabled || false} onChange={(v: boolean) => setEditing({ ...editing, comments_disabled: v })} />
|
||||||
{editing.terms_accepted_at && (
|
{editing.terms_accepted_at && (
|
||||||
<div style={{ fontSize: 12, color: C.textLight }}>
|
<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>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useEffect, useState, useRef } from 'react';
|
import { useEffect, useState, useRef } from 'react';
|
||||||
|
import { formatDisplayDate } from '@/lib/date';
|
||||||
|
|
||||||
interface Room {
|
interface Room {
|
||||||
id: number;
|
id: number;
|
||||||
@@ -398,7 +399,7 @@ export default function RoomsPage() {
|
|||||||
{c.first_name}{c.last_initial ? ` ${c.last_initial}.` : ''}
|
{c.first_name}{c.last_initial ? ` ${c.last_initial}.` : ''}
|
||||||
</strong>
|
</strong>
|
||||||
<span style={{ fontSize: '12px', color: '#777' }}>
|
<span style={{ fontSize: '12px', color: '#777' }}>
|
||||||
{new Date(c.created_at).toLocaleDateString()}
|
{formatDisplayDate(c.created_at)}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<p style={{ margin: 0, color: '#555', fontSize: '14px' }}>{c.text}</p>
|
<p style={{ margin: 0, color: '#555', fontSize: '14px' }}>{c.text}</p>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import { useEffect, useState, useRef } from 'react';
|
import { useEffect, useState, useRef } from 'react';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
|
import { formatDisplayDate, formatDisplayDateTime } from '@/lib/date';
|
||||||
|
|
||||||
interface Trip {
|
interface Trip {
|
||||||
id: number;
|
id: number;
|
||||||
@@ -170,7 +171,7 @@ export default function UserPage() {
|
|||||||
Welcome to Hosteria La Huasca!
|
Welcome to Hosteria La Huasca!
|
||||||
</p>
|
</p>
|
||||||
<p style={{ margin: '0', opacity: 0.9 }}>
|
<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>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</Section>
|
</Section>
|
||||||
@@ -183,11 +184,11 @@ export default function UserPage() {
|
|||||||
<div style={{ display: 'flex', gap: '2rem', flexWrap: 'wrap', marginBottom: '1rem' }}>
|
<div style={{ display: 'flex', gap: '2rem', flexWrap: 'wrap', marginBottom: '1rem' }}>
|
||||||
<div>
|
<div>
|
||||||
<div style={{ fontSize: '12px', color: warm, textTransform: 'uppercase', letterSpacing: '0.05em' }}>Check-in</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>
|
<div>
|
||||||
<div style={{ fontSize: '12px', color: warm, textTransform: 'uppercase', letterSpacing: '0.05em' }}>Check-out</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>
|
</div>
|
||||||
{upcomingTrip.room_name && (
|
{upcomingTrip.room_name && (
|
||||||
<div>
|
<div>
|
||||||
@@ -237,7 +238,7 @@ export default function UserPage() {
|
|||||||
</div>
|
</div>
|
||||||
<div style={{ fontSize: '14px' }}>{m.message}</div>
|
<div style={{ fontSize: '14px' }}>{m.message}</div>
|
||||||
<div style={{ fontSize: '11px', opacity: 0.7, marginTop: '0.25rem' }}>
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user