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

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

Merged

Conversation

andrei-cocorean
Copy link
Contributor

This should solve part of #1500.

@ichernev
Copy link
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
Copy link
Contributor Author

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
Copy link
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
Copy link
Contributor Author

I added the setter and the parsing token.

@icambron
Copy link
Member

icambron commented Apr 7, 2014

Awesome. Thanks for working on this!

icambron added a commit that referenced this pull request Apr 7, 2014
…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
@andrei-cocorean andrei-cocorean deleted the feature/more_quarter_support branch April 8, 2014 12:59
@icambron icambron mentioned this pull request Apr 12, 2014
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

3 participants