PersianDate(0) problem

Dec 24, 2012 at 12:33 PM

hi, new Date(0) return start of unixtimestamp time but PersianDate(0) return 0/1/0  0:0:0 and +new Date() return current unixtimestamp but +new PersianDate() return NaN .


Dec 24, 2012 at 6:01 PM


I fixed the first issue, so 'new PersianDate(0)' should return expected date now.


new Date(0).toPersianDate()	now creates the same date as	 PersianDate(0)

For the second one, I'm not sure how that would be possible to overload the unary + operator for the PersianDate or IntlDate objects. I think that work like that for Date object because it is a native object. And I checked it works the same way as you described, in Chrome, FF and IE. As far as I know overloading arithmetic operators are not supported in JavaScript. see this.

However, I found another inconsistency that I also fixed. Calling Date() without a 'new' keyword creates a new Date object. Although, any arguments passed to it are ignored. For example

Date(2010, 1, 15)

creates new Date() with current timestamp, not the specified date. This usage is discouraged, but implemented PersianDate to behave similarly but outputs a warning to the console.

BTW, for bugs and defects you can open new issue items in issue tracker. That makes it easier to track them if they could not be fixed quickly.