stewdio / skip

18 stars 1 forks source link

Anomaly in unixToYear() and/or yearToUnix() #1

Open craig552uk opened 11 years ago

craig552uk commented 11 years ago

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

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

Using Chrome v21.0.1180.89

stewdio commented 11 years ago

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 notifications@github.comwrote:

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.