Skip to content

[bugfix] duration: parser: Support ms durations in .NET syntax - #3276

Closed
not-an-aardvark wants to merge 2 commits into
moment:developfrom
not-an-aardvark:issue3266
Closed

not-an-aardvark wants to merge 2 commits into
moment:developfrom
not-an-aardvark:issue3266

Conversation

@not-an-aardvark

@not-an-aardvark not-an-aardvark commented Jul 4, 2016 •

Copy link
Copy Markdown
Contributor

Fixes #3266

Note: The rounding behavior described in #3266 (comment) is not currently included in this PR, because it would break a number of existing tests. For example, with the proposed rounding behavior, the duration parsed in this test would have seconds = 5 and milliseconds = 0.

I can add the rounding behavior and change those tests if desired, but that might be considered a breaking change, so I thought it was worth bringing up the issue first. At the moment, extra millisecond digits are simply truncated rather than being rounded.

edit: The rounding behavior has been added to this PR.

@maggiepint

Copy link
Copy Markdown
Member

I would make it round. I understand that it's kind of a breaking change in the sense that the behavior changes, but it really does make more sense. If we have the data for the later decimal places we should use it. Maybe some people have to change their unit tests in some project as a result, but I'd consider that acceptable to fix what really is broken.

@not-an-aardvark

Copy link
Copy Markdown
Contributor Author

Ok, I added the rounding behavior.

@FallingSnow

Copy link
Copy Markdown

Any update on this?

@maggiepint

Copy link
Copy Markdown
Member

LGTM. @mj1856 this is your specialty - you like this?

@mattjohnsonpint

Copy link
Copy Markdown
Contributor

Yep. Looks great. Thanks!

@mattjohnsonpint mattjohnsonpint modified the milestone: 2.15.0 Aug 5, 2016
@ichernev

ichernev commented Sep 1, 2016

Copy link
Copy Markdown
Contributor

Merged in 6848096

@ichernev ichernev changed the title Ensure that millisecond durations are parsed from .NET timestamps [bugfix] duration: parser: Support ms durations in .NET syntax Sep 1, 2016
@ichernev ichernev closed this Sep 1, 2016
ichernev added a commit that referenced this pull request Sep 1, 2016
[bugfix] duration: parser: Support ms durations in .NET syntax
@not-an-aardvark
not-an-aardvark deleted the issue3266 branch September 14, 2016 04: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.

5 participants