-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
IANA timezone support #676
base: main
Are you sure you want to change the base?
Conversation
6c58e0b
to
b635591
Compare
@leshakoss @kossnocorp I've updated this PR with some tests and details for supporting IE. Would love your feedback on this. |
src/toDate/index.js
Outdated
@@ -64,6 +64,7 @@ var patterns = { | |||
* @param {*} argument - the value to convert | |||
* @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options} | |||
* @param {0|1|2} [options.additionalDigits=2] - the additional number of digits in the extended year format | |||
* @param {string} [options.tz] - the time zone to use. Default is local time. Valid options are 'UTC' or Area/Location such as 'America/Cancun'. |
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.
The tz
option is nice and short, but I wonder if it's not worthwhile, just in the interest of consistency across different APIs, to name this option timeZone
as used in the Intl
API itself?
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.
I debated that myself. Given that both you and @leshakoss have indicated a preference for it, I've updated it accordingly
b5805fe
to
2263383
Compare
I have written some documentation for helper functions that might be built around this idea to solve the issues presented in #180 and will create a separate PR with those when they are ready and depending on further discussion in #660. For now any feedback on the documentation would be most welcome. |
I'll leave this open for reference for the time being, but @marnusw has taken this PR even further, so probably best that we focus on that one in terms of review and being merged |
Wow, this is a really elegant solution, love it! Thank you a lot! We'll evaluate this as soon as we finish with v2. Sorry for waiting. |
@kossnocorp I wonder if there any news on this? Any way we can help? |
+1 for this feature |
This uses the DateTimeFormat API. IE users only need the Intl.DateTimeFormat timezone polyfill. Edge users do not need a polyfill