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

Configuration for moving ambiguous or invalid input forward or backward #101

Merged
merged 3 commits into from
Jul 7, 2014

Conversation

timrwood
Copy link
Member

This is the fix for #99. /cc @mj1856

The defaults are to move ambiguous input backward and invalid input forward.

moment.tz.moveInvalidForward;   // true
moment.tz.moveAmbiguousForward; // false

Ambiguous input

moment.tz.moveAmbiguousForward; // false
moment.tz([2012, 10, 4, 0, 30], "America/New_York").format() // 2012-11-04T00:30:00-04:00
moment.tz([2012, 10, 4, 1, 30], "America/New_York").format() // 2012-11-04T01:30:00-04:00
moment.tz([2012, 10, 4, 2, 30], "America/New_York").format() // 2012-11-04T02:30:00-05:00
moment.tz.moveAmbiguousForward = true;
moment.tz([2012, 10, 4, 0, 30], "America/New_York").format() // 2012-11-04T00:30:00-04:00
moment.tz([2012, 10, 4, 1, 30], "America/New_York").format() // 2012-11-04T01:30:00-05:00
moment.tz([2012, 10, 4, 2, 30], "America/New_York").format() // 2012-11-04T02:30:00-05:00

Invalid input

moment.tz.moveInvalidForward; // true
moment.tz([2012, 2, 11, 1, 30], "America/New_York").format(); // 2012-03-11T01:30:00-05:00
moment.tz([2012, 2, 11, 2, 30], "America/New_York").format(); // 2012-03-11T03:30:00-04:00
moment.tz([2012, 2, 11, 3, 30], "America/New_York").format(); // 2012-03-11T03:30:00-04:00
moment.tz.moveInvalidForward = false;
moment.tz([2012, 2, 11, 1, 30], "America/New_York").format(); // 2012-03-11T01:30:00-05:00
moment.tz([2012, 2, 11, 2, 30], "America/New_York").format(); // 2012-03-11T01:30:00-05:00
moment.tz([2012, 2, 11, 3, 30], "America/New_York").format(); // 2012-03-11T03:30:00-04:00

@timrwood timrwood changed the title Feature/configurable rollback Add configuration for moving ambiguous or invalid input forward or backward Jun 30, 2014
@timrwood timrwood changed the title Add configuration for moving ambiguous or invalid input forward or backward Configuration for moving ambiguous or invalid input forward or backward Jun 30, 2014
@mattjohnsonpint
Copy link
Contributor

Looks good to me. Be sure to update the docs as well. Many thanks!

timrwood added a commit that referenced this pull request Jul 7, 2014
Configuration for moving ambiguous or invalid input forward or backward
@timrwood timrwood merged commit c0fe03e into develop Jul 7, 2014
@timrwood timrwood deleted the feature/configurable-rollback branch July 7, 2014 17:34
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

2 participants