spencermountain / spacetime

A lightweight javascript timezone library
http://spacetime.how/
Other
3.97k stars 184 forks source link

dayOfYear in leap years #382

Closed ChrisSeakane closed 1 year ago

ChrisSeakane commented 1 year ago

dayOfYear doesn't work if I want to set to 31st December in a leap year.

let s = spacetime()
s = s.year(2020)
s = s.dayOfYear(366);
console.log(s.json())

I get 30th December (date = 30, month = 11)

image

Maybe I'm stupid/misunderstanding something 🤷

spencermountain commented 1 year ago

Oof! This does look like a bug. Am offline for the weekend, let me take a look then. Thanks for the heads up

ChrisSeakane commented 1 year ago

Of course, no rush. Enjoy the Easter weekend!

spencermountain commented 1 year ago

fixed in 7.4.3 cheers