-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Olson Timezone Support #46
Comments
Agreed! |
Update: Day.js Time Zone Plugin https://day.js.org/docs/en/timezone/timezone +1 Plus, can you share some of timezone use cases? Or which API do we need? |
I work on an enterprise platform that involves 3 external vendors in different parts of the country and nobody could get a timestamp right... so... we all had to agree on Eastern. |
The ability to parse, compare, and render dayjs objects from/in any timezone. Matching the Moment Timezone API probably makes sense for portability. |
A plugin would be acceptable, especially to keep core low (great for perf-minded folks). Especially since then we could take advantage of code-splitting, dynamic imports, etc. where it makes sense to do TZ related stuff (which admittedly, can be for the entire app but at least you're opting in). |
@kamranayub we are working on is, PR #168 Any ideas? |
In a current project, users from different timezone can make appointments, so we have to convert their inputs to UTC before to compare times, then convert back to their local timezone to display on UI. In that case, timezone is not browser timezone, but profile"s IATA timezone such as "Europe/Paris". Conversions looks like:Parsing locale timezone and converting to UTC: const timezoneDate: Date = momentTimezone.tz('2018-08-22 12:30', 'Europe/Paris').utc().toDate(); Getting UTC offset for a date and a timezone: // current timezone offset in Paris
const timezoneOffset: number = momentTimezone(new Date()).tz('Europe/Paris').utcOffset(); |
I am sorry, I did not notice this issue earlier. I opened a feature request #323 for introducing just parsing and formatting support with a specific time zone. I can imagine implementation using both Olson time zone database or the new I do not know, if you wanted to make Day.js more complicated by remembering the original time zone in the Day.js object itself and supporting functions like |
I do this:
|
@IssueHunt has funded $200.00 to this issue.
|
Intl API might be a better choice for our project? |
Sad, looking for MomentJS alternative and I found DayJS but it's have no timezone support, So, I will get Luxon any way. |
This solution works. Just don't do as I did and wonder why |
Any update dude? |
Update: Day.js Time Zone Plugin https://day.js.org/docs/en/timezone/timezone |
Update: Day.js Time Zone Plugin https://day.js.org/docs/en/timezone/timezone
This is great, but without timezone support it's not usable in real-world applications.
The text was updated successfully, but these errors were encountered: