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

More quarter support (add/subtract quarters; startOf/endOf quarter) #1586

Merged
merged 4 commits into from Apr 7, 2014

Conversation

Projects
None yet
3 participants
@andrei-cocorean
Contributor

andrei-cocorean commented Apr 3, 2014

This should solve part of #1500.

@ichernev

This comment has been minimized.

Contributor

ichernev commented Apr 4, 2014

That looks pretty good! Don't you also need a quarter setter (pass value to the getter and handle it).

@andrei-cocorean

This comment has been minimized.

Contributor

andrei-cocorean commented Apr 4, 2014

I don't need the setter, but I can add it. I think it should be equivalent to:

.add('month', (newQuarter - currentQuarter) * 3)

e.g.

moment([2014, 1, 10]).quarter(2).format();  // => 2014-05-10

I'll also take a look at parsing the quarter from a string.

@icambron

This comment has been minimized.

Member

icambron commented Apr 4, 2014

Yeah, I think a setter is important, since 'Q' being in the unitAliases list sort of informally implies you can do moment.set('Q', 3) (which would call moment.quarter(3)). It will also nicely round out the feature.

@andrei-cocorean

This comment has been minimized.

Contributor

andrei-cocorean commented Apr 7, 2014

I added the setter and the parsing token.

@icambron

This comment has been minimized.

Member

icambron commented Apr 7, 2014

Awesome. Thanks for working on this!

icambron added a commit that referenced this pull request Apr 7, 2014

Merge pull request #1586 from andrei-cocorean/feature/more_quarter_su…
…pport

@changelog
@Section features
@description More quarter support (add/subtract quarters; startOf/endOf quarter)

@icambron icambron merged commit 0b2dfcb into moment:develop Apr 7, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details

@andrei-cocorean andrei-cocorean deleted the andrei-cocorean:feature/more_quarter_support branch Apr 8, 2014

@icambron icambron referenced this pull request Apr 12, 2014

Closed

More quarter support #1500

@theurere theurere referenced this pull request Jul 1, 2014

Merged

Update moment.js to 2.7.0 #58

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