uutils / parse_datetime

Parses a relative time string and returns a `Duration`
MIT License
14 stars 17 forks source link

epoch parsing with timezone other than UTC #66

Closed matrixhead closed 3 months ago

matrixhead commented 4 months ago

hi, i think our epoch parsing is not working properly.

if we try to run test_epoch_seconds it would work but if we try changing the timezone to something like env::set_var("TZ", "EST") it would fail. it shouldn't be doing that right? because epoch's should be same even if we change the timezone.

i think it is happening because we are treating NaiveDateTime returned by from_timestamp_opt (which is in UTC) as local time in naive_dt_to_fixed_offset and i think we could fix it by treating it as UTC

if you guys think i'm right can i put together a pr with the necessary changes

tertsdiepraam commented 4 months ago

If it's easy sure, otherwise we can defer this to the new parser.

matrixhead commented 4 months ago

it is a single line change i can put together a pr ASAP 😃, thanks