spencermountain / spacetime

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

subtracting months issue #312

Closed Roman-Vala closed 2 years ago

Roman-Vala commented 2 years ago

Hi there,

I was subtracting months and got same result subtracting 25 and 13, how come ???

const firstOfThisMonth = spacetime.now().startOf('month'); const minus25Months= firstOfThisMonth.subtract(25, 'month');
const minus13Months= firstOfThisMonth.subtract(13, 'month');
console.log(firstOfThisMonth.iso(),minus25Months.iso(),minus13Months.iso());

2022-01-01T00:00:00.000+11:00 2020-12-01T00:00:00.000+11:00 2020-12-01T00:00:00.000+11:00

spencermountain commented 2 years ago

This is a very good issue. I will take a look tomorrow. Thanks

spencermountain commented 2 years ago

fixed in 7.0.0 thanks for the heads-up.

Roman-Vala commented 2 years ago

Thanks for the prompt fix!