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

Suggest optional arguments for setters #2174

Closed
warmsea opened this issue Jan 22, 2015 · 4 comments
Closed

Suggest optional arguments for setters #2174

warmsea opened this issue Jan 22, 2015 · 4 comments

Comments

@warmsea
Copy link

warmsea commented Jan 22, 2015

If it doesn't conflict with the concept of this lib, I hope the setters could have additional optional arguments as the builtin Date do. It could be convenient in some cases.

For example,

moment().year(yearValue[, monthValue[, dayValue]])
moment().hour(hoursValue[, minutesValue[, secondsValue[, msValue]]])
@ichernev
Copy link
Contributor

Why not moment().year(y).month(m).day(d). That should work exactly the same as what you're describing. If not -- then its a bug with the individual setters that should be fixed.

@warmsea
Copy link
Author

warmsea commented Mar 2, 2015

There's no bug.

I was just wondering whether a shorter way could be more convenient. I think it won't be confusing since JS Date has already provided them.

moment().year(y).month(m).day(d);
moment().year(y, m, d);

Please close this issue if it's not necessary. Thank you!

@icambron
Copy link
Member

icambron commented Apr 1, 2015

There's also moment().set({y: year, M: month, d: day})

@icambron icambron closed this as completed Apr 1, 2015
@warmsea
Copy link
Author

warmsea commented Apr 1, 2015

Oh, this one is good. Thank you!

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

No branches or pull requests

3 participants