Fix Introduce a timezoneOffsetService for proposal and fix DST problem #8083
Fix Introduce a timezoneOffsetService for proposal and fix DST problem #8083taiebot wants to merge 18 commits intonextcloud:mainfrom
Conversation
Signed-off-by: taiebot <dedreuil@yahoo.fr>
Replaced manual timezone offset calculation with a call to getTimezoneOffset function. Signed-off-by: taiebot <dedreuil@yahoo.fr>
Refactor timezone handling by removing timezoneOffset state and using getTimezoneOffset function directly in date calculations. Signed-off-by: taiebot <dedreuil@yahoo.fr>
Remove TypeScript type annotations from getTimezoneOffset function. Signed-off-by: taiebot <dedreuil@yahoo.fr>
Signed-off-by: taiebot <dedreuil@yahoo.fr>
Signed-off-by: taiebot <dedreuil@yahoo.fr>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Follow up cache the timezoneId formatter and floor instead of round Signed-off-by: taiebot <dedreuil@yahoo.fr>
Signed-off-by: taiebot <dedreuil@yahoo.fr>
Eslint Signed-off-by: taiebot <dedreuil@yahoo.fr>
Try to fix those things ... Signed-off-by: taiebot <dedreuil@yahoo.fr>
Add error handling to timezone offset calculation Signed-off-by: taiebot <dedreuil@yahoo.fr>
GVodyanov
left a comment
There was a problem hiding this comment.
Hello! We really appreciate your PR for such an annoying issue, good job!
I see that you are having some struggles with ESLint, if you like I could fix that for you seeing as from what I can see vibe coding wasn't able to do that.
Just wanted to mention that we actually have a timezone library which might be useful here: https://github.com/nextcloud-libraries/timezones
|
Hi @GVodyanov please feel free to fix those Linting errors they are driving mad 😠 . I am doing all this directly with the github web interface and it is not giving me any feedback until this is tested by the CI job. About the timezones library comment i do not grasp the relevance. What should i do ? Do i need to do anything ? I tried specifically to keep things as simple as i could. My main goal was :
Found another bug while testing this as well will report it and see if i can also do something about it. Thanks again ✌️ |
|
Note this bug is not triggered for current dates => Next events will get weird around 25 oct 2026 - Daylight Saving Time Ends |
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
Signed-off-by: taiebot <dedreuil@yahoo.fr>
Signed-off-by: taiebot <dedreuil@yahoo.fr>
Signed-off-by: taiebot <dedreuil@yahoo.fr>
|
Hi @taiebot Thank you for the PR, I will review it when I get a few spare minutes |
|
👍 feel free to take it from here. Hopefully it will not be a waste of your time. Just let me know if those AI tested contributions are worth it or if the code quality is subpar and you end up with more corrections than actual contribution I will keep my job of reporting bugs... ❤️ |
Hello all,
Thank you all for this amazing project. I did another pull request which works as well but i think it might have been not that easy to review.
Trying to fix #8040
Be aware that this is my 1st time contributing to a project like Nextcloud and i am not a developer. This work is entirely done with an AI with vibe coding over weekends. Test it carefully to see if it does not break anything else. I tried to be as close as the original code.
I introduce a timezoneOffsetService which allows to reuse it in the two parts of the code.
I managed to test this with https://github.com/szaimen/nextcloud-easy-test and what i could see and looks like it is fixed. 🤯
See original problem in #8040
With this PR
On main

Ai comparison old vs new
The old code derives the timezone offset by converting dates to locale‑formatted strings and back, which is fragile and can mis-handle daylight‑saving transitions because the string round‑trip doesn’t reliably preserve DST rules. It also depends on the system’s locale parsing behavior, which varies across environments and can introduce subtle bugs. The new code avoids these pitfalls by using Intl.DateTimeFormat with formatToParts, which is explicitly designed to respect each timezone’s DST rules. Instead of relying on string parsing, it reconstructs the exact local time components and computes the UTC equivalent using Date.UTC, producing a precise offset even during DST boundaries. The new version caches formatters for performance, while the old version recreates them on every call. Error handling also improves: the old code returns 0 on failure, masking errors, whereas the new code returns null, making issues detectable. Overall, the new implementation is more robust, DST‑safe, locale‑independent, and efficient.