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

Should be an option to return local times from toISOString #1751

Closed
icambron opened this Issue Jul 2, 2014 · 2 comments

Comments

Projects
None yet
3 participants
@icambron
Member

icambron commented Jul 2, 2014

toISOString always returns UTC times. We should support a flag that lets you return the local time instead of requiring the user to do:

moment().format('YYYY-MM-DD[T]HH:mm:ss.SSSZ');

@icambron icambron added the Enhancement label Jul 2, 2014

@ichernev

This comment has been minimized.

Contributor

ichernev commented Jul 2, 2014

+1

Maybe something like

moment().toISOString({tz: false}); // .utc().format()
moment().toISOString({tz: "local"});  // .local().format()
moment().toISOString({tz: true});  // depend on the object (utc, local, zoned moment)
moment().toISOString({tz: "05:00"});  // .zone(str).format()

Internally it would do .local, .utc or .zone. Now it only does .utc.

@marwahaha

This comment has been minimized.

Member

marwahaha commented Apr 13, 2018

This was done in 2.20.0:

moment().toISOString(true)

https://momentjs.com/docs/#/displaying/as-iso-string/

@marwahaha marwahaha closed this Apr 13, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment