spencermountain / spacetime

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

Adding a day fails when interval falls over a DST change #296

Closed coatesap closed 3 years ago

coatesap commented 3 years ago
const start = spacetime('2021-10-31', 'Europe/London').startOf('day')
const end = start.add(1, 'day')

console.log(start.format('iso-utc'), end.format('iso-utc')) // "2021-10-30T23:00:00.000Z", ""

https://jsfiddle.net/coatesap/bk5p3avw/

coatesap commented 3 years ago

I've submitted #297 to fix this now.

This caused a nasty bug in our app, as every() relies on add() working correctly, so generating date ranges over a DST change was completely screwy.

spencermountain commented 3 years ago

thank you for your help!