-
Notifications
You must be signed in to change notification settings - Fork 837
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
Bug when parsing unix timestamp and using default time zone #338
Comments
I added a unit test for this to my fork of the repo: westy92@dde7030. |
Sorry, is there a solution for this issue at the moment (besides of the unit test added)? Or, is there any other way to apply kind of "default" timezone to all subsequent moment().format() calls? |
The workaround for now is to pass the timestamp as a number instead of a string. moment.unix(1461906597) // seconds
moment(1461906597123) // milliseconds If you have a string, then use |
Thank you! Will it apply my default timezone, or just help to avoid errors?
|
It's a better form to use anyway, and yes - it will work with the default time zone. The bug is only that the default timezone isn't working with |
As reported in moment/moment#3158 there is an issue where parsing an 'X' token will not work correctly with a default timezone.
This is an issue with the way updateOffset handles default time zones.
This bit of code will attempt to take the initial _a array from the moment config, and use it to construct a new UTC moment. With a timestamp, _a is an array with a bunch of undefined values, ergo this doesn't work.
The text was updated successfully, but these errors were encountered: