-
Notifications
You must be signed in to change notification settings - Fork 375
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
Timezones #6822
Timezones #6822
Conversation
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.
This approach looks good for displaying time correctly based on dataset. I remember some conversation about timezones and DEA's imagery filtering - does this PR solve the problem, where the date is different due to timezones and so dates don't line up with those in data_available_for_dates
from DEA and so the imagery fetched is wrong? Or is it not an issue, or should be dealt with separately?
It'd also be good to get some test cases, where timeZone is set differently.
I've left a few comments for minor improvements.
lib/Core/DateUtils.ts
Outdated
export function getOffsetMinutes(timeZone: string): number { | ||
const [hoursString, minutesString] = timeZone.split(":"); | ||
const hours = parseInt(hoursString); | ||
const minutes = parseInt(minutesString); | ||
return hours * 60 + minutes; | ||
} |
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.
This fails when a timeZone of "+11" is used. I think it'd be good to support that form of timezone too.
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.
Added regex check, so the function now checks for the timeZone to be in the format +/- HH:MM or +/-HH if not it will return 0 in which case no offset will be applied
Is it also still possible for people from different time zones to have different dates appear (see comment on opendatacube)?
Also, on a similar track, my earlier question below:
I think if you set a timezone of +3 on a dataset, the dataset says it has imagery for 2020-01-01 and you access it from the US (-7) you'll get the wrong date displaying - even after this PR. That's a difficult problem. |
you're correct Crispy, this PR does not address that issue. Because we set that as a Date object the browser will always interpret it to local time. If we wanted it to be displayed as it is delivered i.e not interpreted to local time, we could treat is a string in the display. Perhaps have a trait "staticTime" (names are hard) and if its true, display the string, not the date object. |
What this PR does
Fixes #6817
Add the ability to set a timeZone offset and a dateFormat
item example
Created new trait class which extends ModelTraits
DateTimeTraits
has 2 traits
timeZone
which takes an UTC offset with the format "+10:00"dateFormat
see useage at -- https://github.com/felixge/node-dateformatTest me
http://ci.terria.io/timezones/#clean&https://gist.githubusercontent.com/sixlighthouses/a9d1e72fba0002caa068dd90418be5bc/raw/e7363a308f156e00f637b6bfa81ade10824b95ec/test.json
View the layers
The display of each of the layers datetime data in the workbench and timeline are defined by the following config
Checklist
doc/
.