mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-29 06:47:07 -05:00
Fix timezone-independent date display
This commit is contained in:
@@ -3,6 +3,7 @@ import { Button } from '@/components/ui/button';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { format } from 'date-fns';
|
||||
import { parseDateForDisplay } from '@/lib/dateUtils';
|
||||
import type { TimelineEvent } from '@/types/timeline';
|
||||
|
||||
interface TimelineEventCardProps {
|
||||
@@ -14,8 +15,10 @@ interface TimelineEventCardProps {
|
||||
isPending?: boolean;
|
||||
}
|
||||
|
||||
// ⚠️ IMPORTANT: Use parseDateForDisplay to prevent timezone shifts
|
||||
// YYYY-MM-DD strings must be interpreted as local dates, not UTC
|
||||
const formatEventDate = (date: string, precision: string = 'day') => {
|
||||
const dateObj = new Date(date);
|
||||
const dateObj = parseDateForDisplay(date);
|
||||
|
||||
switch (precision) {
|
||||
case 'year':
|
||||
|
||||
Reference in New Issue
Block a user