mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 12:51:14 -05:00
Fix timezone-independent date display
This commit is contained in:
@@ -3,6 +3,7 @@ import { Badge } from '@/components/ui/badge';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Calendar, MapPin, ArrowRight, Building2 } from 'lucide-react';
|
||||
import { format } from 'date-fns';
|
||||
import { parseDateForDisplay } from '@/lib/dateUtils';
|
||||
|
||||
interface HistoricalEntityCardProps {
|
||||
type: 'park' | 'ride';
|
||||
@@ -65,9 +66,10 @@ export function HistoricalEntityCard({ type, entity, onViewDetails }: Historical
|
||||
<span>Operated:</span>
|
||||
</div>
|
||||
<div className="font-medium">
|
||||
{entity.operated_from && format(new Date(entity.operated_from), 'MMM d, yyyy')}
|
||||
{/* ⚠️ Use parseDateForDisplay to prevent timezone shifts */}
|
||||
{entity.operated_from && format(parseDateForDisplay(entity.operated_from), 'MMM d, yyyy')}
|
||||
{' - '}
|
||||
{entity.operated_until && format(new Date(entity.operated_until), 'MMM d, yyyy')}
|
||||
{entity.operated_until && format(parseDateForDisplay(entity.operated_until), 'MMM d, yyyy')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user