Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

datetime issue #14

Open
ghost opened this issue Feb 24, 2016 · 2 comments
Open

datetime issue #14

ghost opened this issue Feb 24, 2016 · 2 comments

Comments

@ghost
Copy link

ghost commented Feb 24, 2016

python 3.4.3, pytoml==0.1.7

>>> import pytoml as toml
>>> import datetime
>>> d={'dt':datetime.datetime.now()}
>>> d
{'dt': datetime.datetime(2016, 2, 25, 11, 18, 17, 536767)}

>>> toml.dumps(d)
'dt = 2016-02-25T11:18:17.536767Z\n'
>>> toml.loads(toml.dumps(d))
{'dt': datetime.datetime(2016, 2, 25, 11, 18, 17, 536767, tzinfo=<pytoml.parser._TimeZone object at     0x7f9aca381978>)}
>>> d == toml.loads(toml.dumps(d))
False
@takluyver
Copy link

TOML 0.4 only allowed datetimes with timezone information attached - what Python calls a "datetime aware" datetime. When you dump a "naive" timezone, with no timezone info, it looks like pytoml opts to treat that as meaning UTC.

TOML 1.0 (not out yet) adds a separate 'local datetime' type for timestamps without timezone information. toml-lang/toml#414

@avakar
Copy link
Owner

avakar commented May 30, 2018

Thanks for the issue!

As @takluyver points out, this is not a bug, pytoml accepts naive datetimes only as a convenience. Adding compliance with 1.0 would be a new feature and I'm not working on those anymore. Feel free to send a PR though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@takluyver @avakar and others