Skip to content

Use UTC times consistently #285

@nathanjmcdougall

Description

@nathanjmcdougall

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions