mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 13:11:14 -05:00
Fix timezone-independent date display
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { format } from 'date-fns';
|
||||
import { parseDateForDisplay } from '@/lib/dateUtils';
|
||||
import type { DatePrecision } from './flexible-date-input';
|
||||
|
||||
interface FlexibleDateDisplayProps {
|
||||
@@ -18,7 +19,9 @@ export function FlexibleDateDisplay({
|
||||
return <span className={className || "text-muted-foreground"}>{fallback}</span>;
|
||||
}
|
||||
|
||||
const dateObj = typeof date === 'string' ? new Date(date) : date;
|
||||
// ⚠️ IMPORTANT: Use parseDateForDisplay to prevent timezone shifts
|
||||
// YYYY-MM-DD strings must be interpreted as local dates, not UTC
|
||||
const dateObj = parseDateForDisplay(date);
|
||||
|
||||
// Check for invalid date
|
||||
if (isNaN(dateObj.getTime())) {
|
||||
|
||||
Reference in New Issue
Block a user