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

Better timezone support for manipulating moments #1419

Closed
wants to merge 1 commit into from

Conversation

kroo
Copy link
Contributor

@kroo kroo commented Jan 15, 2014

This adds a second argument to setters that provides a hint to updateOffset to not change hours/minutes when crossing a tz boundary. This is frequently desirable when modifying part of an existing moment object directly.

It further passes this argument whenever adding / subtracting days or months, fixing an issue with moment-timezone (moment/moment-timezone#28). See the corresponding PR for moment-timezone here: moment/moment-timezone#53.

This adds a second argument to setters that provides a hint to updateOffset to not change hours/minutes when crossing a tz boundary.  This is frequently desirable when modifying part of an existing moment object directly.

It further passes this argument whenever adding / subtracting days or months, fixing an issue with moment-timezone (moment/moment-timezone#28).  See the corresponding PR for moment-timezone here: moment/moment-timezone#53.
@icambron
Copy link
Member

Haven't had time to look at this in detail (and the matching moment-timezone PR), but generally +1; we'll get this in.

@joshuabambrick
Copy link

+1

hurray

@ichernev
Copy link
Contributor

ichernev commented Feb 6, 2014

Don't we need to default the date setter to dontAdjust=true? So if you're changing the date it won't mess up the offset?

ichernev added a commit that referenced this pull request Feb 6, 2014
Pass updateOffset a flag to tell it whether to change the sub-day
units if adjusting the timezone. If you cross DST by day or larger than its
assumed you don't want to see offset change in the hour.

@changelog
@section bugfix
@description Better timezone support for manipulating moments
@ichernev
Copy link
Contributor

ichernev commented Feb 6, 2014

I merged it manually. Thank you very much!!

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

Successfully merging this pull request may close these issues.

None yet

4 participants