-
Notifications
You must be signed in to change notification settings - Fork 156
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
non-utc datetime-arithmetic is out-of-scope in javascript? #142
Comments
I’m not sure what the point of this issue is - could you elaborate? Note that i have encountered non-UTC date arithmetic frequently - see https://github.com/airbnb/react-dates which does it specifically for UI all the time - so this capability is incredibly critical for UI development in particular. |
that library/example is for date-only arithmetic, which is distinct from datetime-arithmetic. if additionally, the ui employed a time-picker, its preferable to transform the datetime to utc-reference so that both javascript and non-javascript systems on the backend can perform datetime-arithmetic consistently. |
I don't agree that's preferable, nor that that's the way it's commonly done. |
adding anecdotal datatpoint. at my current employ (a .net/c# shop), datetime-values are always converted to utc-reference when ingested into our system. this has also been the case with past 2 jobs. so baton-passing/ingesting non-utc datetime is uncommon in my experience. date-only values (e.g. "2019-10-07") are a separate issue. |
If we're sharing anecdata, at Google we have separate types for local date-times (what this proposal calls "civil") and for instants (i.e. UTC times). We use them pervasively. Converting to UTC for non-instants would not pass code review. |
thx for anecdata. curious, but is non-utc datetime-arithmetic (not date-arithmetic) pervasively used as well? |
Regarding what Google does in C++, feedback from the Google library authors is here: #139 |
To bring back
I'm still not sure what the point of this discussion is. @kaizhu256 are you trying to suggest that this proposal is not needed? That a subset of this proposal is not needed? Something else? |
is non-utc datetime-arithmetic useful or an anti-pattern in javascript's problem-space? i'm thinking it might be an anti-pattern -- if you want to do datetime-arithmetic, it should be in utc-reference only. |
Yes, it's quite useful. For example, consider "OK Google, remind me tomorrow at this time to water the plants", said at 4pm. You don't want that to be converted to UTC, add 1 day, and convert back to local time. That could give results off by one hour, because my local time zone experiences daylight savings time, whereas UTC does not. You need local-time-aware date arithmetic to handle cases like this. |
More generally, most website's / app's do not need to worry about multiple timezones. They will only ever be used in "local" time. I would argue that letting someone manipulate local time is important from an accessibility standpoint, where here accessibility means "inexperienced developer". |
Closing this since the conversation seems to have reached consensus. Feel free to reopen. |
in most software-integration scenarios i've encountered, javascript datetime-arithmetic is done exclusively in utc-reference to maintain consistency with parallel calculations done by databases, shell-scripts, and other external-systems i have to interact with.
note that this is different/distinct from date-only arithmetic.
The text was updated successfully, but these errors were encountered: