Open luigar opened 2 weeks ago
Welcome, luigar!
First of all, excuse me for my belated response; it's been a complicated time! After having a look at the code (as well as my pictures and dates), I must admit I never encountered the problem you're experiencing. That's why, after thinking of it, I concluded that it might be related to different time zones, as I kept in mind Europe/Madrid (Barcelona, to be more specific), but I didn't consider other options.
In all honesty, the getRelativeTimeString
function might be potentially problematic due to the way it handles dates and times - especially when it comes to different time zones. Could you please give the following alternative a try and tell me if it solves your problem?
export const getRelativeTimeString = (date: string) => {
const parsedDate = DateTime.fromISO(date, { zone: 'utc' }); // You'll have to explicitly set the zone here.
const relativeTime = parsedDate.toRelative();
// Formatting the date in a specific time zone might help, too. Let's say 'Europe/London' here, for instance.
const formattedDate = parsedDate.setZone('Europe/London').toLocaleString(DateTime.DATETIME_MED);
return `${relativeTime} (${formattedDate})`;
}
Perhaps we should explicitly handle time zones when parsing and formatting dates for more consistent behavior. Let me know if it works for you; if that's not the case, we'll look for another solution! Best wishes,
Judit
Describe the bug
Adding PINS with a date are showing 1 day before the actual date , example 2024-06-12 is posting as 2024-06-11 same with other dates.
Steps to reproduce
Do you have any screenshots?
Code of Conduct
Contributing Docs