spencermountain / spacetime

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

Incorrect instance construction when using a timezone #343

Closed coatesap closed 1 year ago

coatesap commented 2 years ago

The construction of a Spacetime instance seems to be affected by the system timezone, even when a specific timezone is supplied as the second parameter:

// system timezone set to Europe/London

spacetime('2022-10-30 00:00:00', 'America/New_York').epoch
// = 1667098800000 - wrong - should be: 1667102400000

spacetime('2022-10-30 00:00:00', 'America/New_York').format('iso-utc')
// = 2022-10-30T03:00:00.000Z - wrong - should be: 2022-10-30T04:00:00.000Z

This seems to being affected by the fact that in London there is a DST change on that day. But that should be irrelevant given that we've been explicit about what we mean in the constructor.

spencermountain commented 2 years ago

hey Andy, could this be #235 ? cheers

coatesap commented 1 year ago

@spencermountain - Was this fixed as part of some other issue or branch?

spencermountain commented 1 year ago

Nope, still exists as #235 I’m afraid. Fix in the works but it’s taking time.