Skip to content
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

How to convert time? #2029

Closed
dts7 opened this issue Nov 2, 2014 · 3 comments
Closed

How to convert time? #2029

dts7 opened this issue Nov 2, 2014 · 3 comments

Comments

@dts7
Copy link

dts7 commented Nov 2, 2014

Good afternoon

How to convert time?

Example: "13:00 - 15:00 Europe/London".

If the user has a time zone of "Europe/Moscow", time has to be "16:00 - 18:00".

@ichernev
Copy link
Contributor

You can have a look at the moment-timezone plugin.

moment.tz("13:00", "HH:mm", "Europe/London").tz("Europe/Moscow").format()

@dts7
Copy link
Author

dts7 commented Nov 12, 2014

I didn't expect, thanks for the answer.
The decision helped, the truth I couldn't find it independently.
I started even writing a plug-in.
I spent about a week.
There is one remark on your code.
The time zone needs to be checked for existence of gaps and to replace them with underlining.
At present 'America/New York' isn't accepted.
"Moment Timezone has no data for America/New York. See http://momentjs .com/timezone/docs/#/data-loading/. moment-timezone-with-data.js:297"
I was helped by ".replace (' ', '_')"

@ichernev
Copy link
Contributor

Well, timezone names have well defined names, that have underscores. Its not supposed to very human readable, just somewhat.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants