-
Notifications
You must be signed in to change notification settings - Fork 9
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
Fix time range selector timezones #6
Conversation
Kudos, SonarCloud Quality Gate passed!
|
Updated node from @justmejulian , @sosostris , you might wanna check this on your internal builds as well? |
Thank you Mezzo! |
Thanks for the review, @nicholas-os . @justmejulian , do you also wanna have a quick look? |
Discussed with @sosostris , @justmejulian & Thomas, merging now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can do destructuring here :
const TimeRangeNavigationBar = (props) => {
const TimeRangeNavigationBar = ({from, lowerBound}) => {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks loads cleaner and fixes the failing tests. Thanks!
@neonnoon I merged all the changes to local repo and somehow the tests were failing due to formatting (the values are all correct), like this:
But the tests are all passing here, so it's super weird. Checked a bit together with @Sakai-san and we found that the implementation of the method Intl.DateTimeFormat seems to vary with machine-os-language-set-up, e.g. there are similar issues reported here https://stackoverflow.com/questions/52797070/intl-datetimeformat-with-format-options-doesnt-work-for-it-ch I will create a ticket to follow up with this. It would be nice to unify all the display to be one format :) |
Ah.. I had the same issue. See build result: See https://github.com/open-ch/pyrene/runs/2129628724 You might have to check the bamboo build agents. |
This PR removes all uses of
date-fns-tz
(except from test code). In my opinion,date-fns-tz
actually complicates things significantly. From a time range point of view, there are no timezones, there's a start and end timestamp. So, the timezone only becomes relevant for display.Intl.DateTimeFormat
[1] handles this well. In my opinion,date-fns-tz
can be useful to handle string to timestamp if a timezone is involved, i.e., figuring out the timestamp of "17 Mar 11:05".If I understood things right, there's actually three timezones involved, local time, utc, and zoned time. Having the browser (or the tests) run in Europe/Zurich looks correct, using GMT though shows the discrepancy.
[1] https://caniuse.com/?search=DateTimeFormat