PersianDate icon indicating copy to clipboard operation
PersianDate copied to clipboard

Set hour(0) not working

Open mort3za opened this issue 5 years ago • 1 comments

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(), ...

mort3za avatar Mar 22 '19 21:03 mort3za

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.

mokhosh avatar Sep 16 '19 04:09 mokhosh