moment().endOf('hUnit') is not working ..
MhdSyrwan opened this issue ยท 3 comments
MhdSyrwan commented
Hi,
Thank you very much for making this plugin ๐ .
I'm trying to execute this line (from the readme)
moment('2014-11-28 16:40:00', 'YYYY-M-D HH:mm:ss').endOf('hMonth').format('hYYYY/hM/hD HH:mm:ss'); // 1436/2/30 23:59:59
it doesn't give the result mentioned in the comment 1436/2/30 23:59:59
and also tried many variants, it looks like endOf
method is not affecting the date if given hmounth
or hyear
or anything outside the standard moment units.
Any thoughts about this ?
MhdSyrwan commented
After looking at the original code of moment
here i tried doing it manually like
moment('2014-11-28 16:40:00', 'YYYY-M-D HH:mm:ss').startOf('hmonth').add(1, 'hmonth').subtract(1, 'milliseconds').format('hYYYY/hM/hD HH:mm:ss'); // 1436/2/30 23:59:59
And it worked ! ๐
It seems that there's a problem running normalizeUnits
or it could be solved by adding a definition for the method endOf
in this repo just like what have you done for the startOf
here
msarhan commented
Issue fixed!
Thanks!
MhdSyrwan commented
Thanks for your quick response ๐