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
Get last day of the month? #242
Comments
I guess for now this works: |
Also, the setters overflow if they are out of range. moment().date(0); // the last day of last month
moment().date(-1); // the second to last day of last month
moment().hours(25); // 1 am the next day So you could do something like this... moment().add('months', 1).date(0); |
moment().endOf('month'); works since 1.7 |
moment().endOf('month'); or moment(year-month-day).endOf('month'); |
@lance-ding Thanks! That's was definitely helpful. I still think it would be nice to have a |
Related: you can also use |
Related:
So a little change to the code would be: |
@gideonapollob , yep. You would need to reverse in your But |
You may get last day of month. like this.
|
which shows last month last date moment().subtract(1, 'months').endOf('month').format('DD-MM-YYYY') |
here last day 31 wont getting |
Without context, it's hard to know which month you're trying to get a result for, but there are only 30 days in November, the current month. |
Will be great to be able to get/set moment instance to last day of the month - similar to eod.
The text was updated successfully, but these errors were encountered: