mobile version calendar page popup debug

This commit is contained in:
Harivansh Rathi 2024-11-23 15:47:12 -05:00
parent 8fd48a7740
commit 0da98e0344

View file

@ -159,13 +159,17 @@ export const Calendar: React.FC<CalendarProps> = ({
}); });
}; };
// Update where dates are displayed // Update the formatDisplayDate function to handle UTC dates correctly
const formatDisplayDate = (dateStr: string) => { const formatDisplayDate = (dateStr: string) => {
const date = new Date(dateStr + 'T00:00:00.000Z'); // Create a UTC date from the ISO string
const [year, month, day] = dateStr.split('-').map(Number);
const date = new Date(Date.UTC(year, month - 1, day));
return date.toLocaleDateString('default', { return date.toLocaleDateString('default', {
month: 'long', month: 'long',
day: 'numeric', day: 'numeric',
year: 'numeric' year: 'numeric',
timeZone: 'UTC' // Ensure we use UTC timezone
}); });
}; };