-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
duplicate days. #29
Comments
This happens to me as well. Set the default date to now. Then set the year to 2020, and subtract 1 month from that date. @MarceloPrado let me know if this didn't reproduce the bug, and then I will create a repro. |
we're also facing this duplicate day issue. |
Hi folks! Could you share a snippet that helps reproing the issue? Something like this would be really helpful for me |
Sure thing, I'll try to create one in the next week 👍 |
Hi @MarceloPrado, Here is the link to the minimal bug reproducer. Here are the steps to follow to get to the warning:
Here is the video of it: Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-04-26.at.13.33.12.mp4If you press Let me know if you needed any more information 😉 |
@AlirezaHadjar thanks for taking the time with the repro. Interestingly, I can't repro the duplicate key error: CleanShot.2024-04-26.at.10.13.13.mp4I tried running with both |
@MarceloPrado I'm using 2024-04-26_17-06-27.mp4 |
@a-eid @m-reda1996 could any of you guys try out the repro I shared please and see if the issue happens to you or not? If not, we can reproduce it in another way |
@AlirezaHadjar I tried again from a different computer and unfortunately it also didn't repro it 😔 |
Yeah sure, I'll do it when I find some free time 🙂 |
@MarceloPrado I dug deeper and found out that sometimes two dates get the same id and label. And the reason you don't face this is because of our timezone difference. For example ![]() I changed export function toDateId(date: Date) {
const year = date.getFullYear();
const month = date.getMonth() + 1; // getMonth() returns 0-11
const day = date.getDate();
// Pad single digit month and day with leading zeros
const monthFormatted = month < 10 ? `0${month}` : month;
const dayFormatted = day < 10 ? `0${day}` : day;
return `${year}-${monthFormatted}-${dayFormatted}`;
} to: export function toDateId(date: Date) {
const year = date.getUTCFullYear();
const month = date.getUTCMonth() + 1; // getMonth() returns 0-11
const day = date.getUTCDate();
// Pad single digit month and day with leading zeros
const monthFormatted = month < 10 ? `0${month}` : month;
const dayFormatted = day < 10 ? `0${day}` : day;
return `${year}-${monthFormatted}-${dayFormatted}`;
} This fixed the BTW, my timezone is |
@AlirezaHadjar nice find! thanks! |
I was able to repro locally but don't have a good fix yet. Turns out Tehran abolished DST timezones couple of years ago and I'm not entirely sure the best way to handle that lol |
This sounds like another one of those date-time edge cases that is unavoidable when working in non-UTC timezones. My guess is that you'll have to build the dates for each month within the context of the local timezone, rather than from UTC and then converting it into the local timezone. |
sometimes we get duplicate days, it's not consistent but it happens quit often, we're not using anything advanced.
The text was updated successfully, but these errors were encountered: