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

startOf is not using setDefault timezone #382

Closed
renatoagds opened this issue Sep 18, 2016 · 1 comment
Closed

startOf is not using setDefault timezone #382

renatoagds opened this issue Sep 18, 2016 · 1 comment

Comments

@renatoagds
Copy link

renatoagds commented Sep 18, 2016

When I use setDefault to a specific timezone, startOf is not assuming that timezone and is using local timezone instead.

var localActual = moment([2016, 1, 1, 16, 0, 0]).unix();
var localStart = moment([2016, 1, 1, 16, 0, 0]).startOf('day').unix();

moment.tz.setDefault('America/Los_Angeles');

var mockedActual = moment([2016, 1, 1, 16, 0, 0]).unix();
var mockedStart = moment([2016, 1, 1, 16, 0, 0]).startOf('day').unix();

console.log(localActual === mockedActual); // false
console.log(localStart === mockedStart); // true

I already created an example in my codepen, here.

@mattjohnsonpint
Copy link
Contributor

Dup #208

Thanks.

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

No branches or pull requests

2 participants