PersianDate
PersianDate copied to clipboard
Set hour(0) not working
I think there is a bug in .hour(number)
:
new persianDate([1397,1 ,1 , 2]).hour(0).format()
Should return "۱۳۹۷-۰۱-۰۱ ۰۰:۰۰:۰۰ ق ظ"
But returns ۱۳۹۷-۰۱-۰۱ ۰۲:۰۰:۰۰ ق ظ (same as input)
Same issue for other similar methods such as .minute(), ...
i had the same problem with second(0)
.
after scratching my head for a good couple of minutes i guessed that the issue is related to javascript treating 0
as a falsy
value and recognizing second(0)
as a getter and not a setter. so i did this as a work around and it works: second('0')
just wrap 0
in a string.