nimpylib / pylib

"Write Python in Nim!" Python builtins/standard-Lib functions ported to Nim
https://nimpylib.github.io/pylib/
MIT License
9 stars 0 forks source link

datetime with non-UTC,None tzinfo is wrong #21

Closed litlighilit closed 4 months ago

litlighilit commented 4 months ago

Desc

import pylib/Lib/n_datetime
let
  td = timedelta(hours=3)
  tz = timezone(td, "tzname")
  dt = datetime(
    1, 1, 1,
    tzinfo = tz)
echo dt.isoformat()

output:

0343-10-05T21:00:00+03:00

You can inspect that dt.dt.utcOffset is a surprise;

Version

Nim: any pylib: 0.9.1

Additional Info

As mentioned in title, at least datetime with TzNone as tzinfo is of no problem.