-
Notifications
You must be signed in to change notification settings - Fork 59
Open
Description
Hi,
First of all, congratulations for this excellent module which greatly simplifies the use of dates in Lua.
I'm writing a timestamp -> iso8601 converter using this module and I'm having a problem when the clock switches from summer time to winter time.
I am in France and on October 29, 2023 we switch to winter time.
I wrote this little piece of code:
local date = require('date')
local ts1 = 1698537600 -- 2023-10-29T00:00:00Z or 2023-10-29T02:00:00+02:00
local ts2 = 1698541200 -- 2023-10-29T01:00:00Z or 2023-10-29T02:00:00+01:00
local d1, d2 = date(ts1), date(ts2)
local d1, d2 = date(ts1), date(ts2)
print("ts1 iso8601 UTC :", d1:fmt("${iso}Z"))
print("ts2 iso8601 UTC :", d2:fmt("${iso}Z"))
local d1local, d2local = date(ts1):tolocal(), date(ts2):tolocal()
print("ts1 iso8601 local:", d1local:fmt("${iso}") .. d1local:fmt("%z"))
print("ts2 iso8601 local:", d2local:fmt("${iso}") .. d2local:fmt("%z"))
And I get the following display::
ts1 iso8601 UTC : 2023-10-29T00:00:00Z --> good
ts2 iso8601 UTC : 2023-10-29T01:00:00Z --> good
ts1 iso8601 local: 2023-10-29T02:00:00+0100 --> bad
ts2 iso8601 local: 2023-10-29T02:00:00+0100 --> good
Is there a problem in the module or is it a problem using the module on my side?
Metadata
Metadata
Assignees
Labels
No labels