-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Have time.js use UTC-related getters/setters #30857
Conversation
Thank you for the fix. TBH I didn't quite get the point how the bug occurs, and why UTC fixes the bug .... if the problem could be clarified, maybe we could also add some tests |
Yes, after looking at this for some time I observed that the output of I'm am not well versed in working with Date-related APIs yet, but I believed that these differing values were caused by the If you see this approach as an issue please let me know! Edit: I changed my PR description to better explain the problem at hand. |
Take a quick look:
|
Sorry I wasn't specific enough about describing the problem. It is caused by both gitea/web_src/js/utils/time.js Lines 39 to 47 in bb0e4ce
This is what causes the chart data to not be displayed. Regarding your question, I don't think it would be an issue to use UTC-based methods here too. I'll make the changes.
I agree, I'll go ahead and add one or two there. |
Recent changes has Having some trouble writing a test for |
Decided to refactor I manually tested with PDT and China Standard Time on all 3 Activity pages and it appears to work fine. I wondered if the I am still pondering how to test this. As I said this test should ensure that the output of this function remains the same when dealing with different timezones, but I haven't seen a way to temporarily change the timezone when working with
|
Date
So... after integrating dayjs's utc plugin it worked perfectly fine in my dev environment but when running the frontend tests it freezes when it reaches Edit: Ohh I see the problem. The |
No more infinite loop!
Before this patch, we were using `Date` getter/setter methods that worked with local time to get a list of Sundays that are in the range of some start date and end date. The problem with this was that the Sundays are in Unix epoch time and when we changed the "startDate" argument that was passed to make sure it is on a Sunday, this change would be reflected when we convert it to Unix epoch time. More specifically, I observed that we may get different Unix epochs depending on your timezone when the returned list should rather be timezone-agnostic. This led to issues in US timezones that caused the contributor, code frequency, and recent commit charts to not show any chart data. This fix resolves this by using getter/setter methods that work with UTC since it isn't dependent on timezones. Fixes go-gitea#30851. --------- Co-authored-by: Sam Fisher <fisher@3echelon.local>
Thanks! Looking at the |
* giteaofficial/main: Have time.js use UTC-related getters/setters (go-gitea#30857) Do not show monaco JS errors (go-gitea#30862) Fix issue/PR title edit (go-gitea#30858) Add result check in TestAPIEditUser (go-gitea#29674)
Before this patch, we were using
Date
getter/setter methods that worked with local time to get a list of Sundays that are in the range of some start date and end date. The problem with this was that the Sundays are in Unix epoch time and when we changed the "startDate" argument that was passed to make sure it is on a Sunday, this change would be reflected when we convert it to Unix epoch time. More specifically, I observed that we may get different Unix epochs depending on your timezone when the returned list should rather be timezone-agnostic.This led to issues in US timezones that caused the contributor, code frequency, and recent commit charts to not show any chart data. This fix resolves this by using getter/setter methods that work with UTC since it isn't dependent on timezones.
Fixes #30851.