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

Use UTC times consistently #285

Open
nathanjmcdougall opened this issue Jul 24, 2024 · 1 comment
Open

Use UTC times consistently #285

nathanjmcdougall opened this issue Jul 24, 2024 · 1 comment

Comments

@nathanjmcdougall
Copy link
Contributor

nathanjmcdougall commented Jul 24, 2024

Regarding this comment:

# TODO: the datetime from pins is not timezone aware, but it looks like
# R pins parses as UTC, then unsets the UTC part?

As far as I can tell, R pins will write the created datetime as a UTC time:

https://github.com/rstudio/pins-r/blob/de47c3141d97020e9f4a6a2e93d5823bc649105b/R/meta.R#L50

And the functions it uses to parse datetimes also specify UTC (although the two parse_ functions indeed strip it out).
https://github.com/rstudio/pins-r/blob/de47c3141d97020e9f4a6a2e93d5823bc649105b/R/meta.R#L55-L68

I haven't looked into this too deeply though.

As far as I can tell, Python pins will just use the local datetime, e.g.

created = datetime.now()

I suggest that this behaviour is changed (this is arguably a breaking change, arguably a bugfix) to use UTC consistently everywhere. To that end, the DTZ rules in ruff could be helpful to enable.

In any case, I think it would be worth documenting this behaviour in more detail.

@jeffkeller-einc
Copy link

This tripped me up for longer than I care to admit today. My workaround was to set the environment variable TZ=utc so that Python pins detected the local timezone as UTC.

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

2 participants