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
base: develop
from

Conversation

Projects
None yet
4 participants
@kroo
Contributor

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.

Better timezone support for manipulating moments
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

This comment has been minimized.

Member

icambron commented Jan 15, 2014

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

@joshbambrick

This comment has been minimized.

joshbambrick commented Jan 23, 2014

+1

hurray

@ichernev

This comment has been minimized.

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

Merge pull request #1419 from kroo/develop
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

This comment has been minimized.

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