skip icon indicating copy to clipboard operation
skip copied to clipboard

Anomaly in unixToYear() and/or yearToUnix()

Open craig552uk opened this issue 13 years ago • 1 comments

There's something slightly amis in these date conversion functions.

(2012).yearToUnix().unixToYear()          // 2011
(1325289600).unixToYear().yearToUnix()    // 1293753600

Using Chrome v21.0.1180.89

craig552uk avatar Sep 22 '12 07:09 craig552uk

Hi Craig.

You're right. I forgot that everything in JavaScript's Date() object is zero-indexed, except for days of the month, which begins at one instead of zero: JavaScript epoch = Date.UTC( 1970, 0, 1, 0, 0, 0, 0 )

It's corrected now. Soon to be uploaded. Thanks.

s

On Sat, Sep 22, 2012 at 3:50 AM, Craig Russell [email protected]:

There's something slightly amis in these date conversion functions.

(2012).yearToUnix().unixToYear() // 2011 (1325289600).unixToYear().yearToUnix() // 1293753600

Using Chrome v21.0.1180.89

— Reply to this email directly or view it on GitHubhttps://github.com/stewdio/skip/issues/1.

stewdio avatar Sep 24 '12 01:09 stewdio