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

TimestampType.__str__ doesn't honor timezone offset #28

Open
jvolkman opened this issue May 7, 2021 · 1 comment
Open

TimestampType.__str__ doesn't honor timezone offset #28

jvolkman opened this issue May 7, 2021 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@jvolkman
Copy link

jvolkman commented May 7, 2021

When parsing a timestamp (e.g., timestamp("2020-10-20T12:00:00-05:00")), the provided timezone offset is stored but not output by __str__ or __repr__ which are hard coded to output the Z UTC abbreviation.

I think this is just a display issue, as the offset does appear to be used in comparisons. But it can be confusing when playing around in a repl shell. Example:

In [155]: utc = celtypes.TimestampType('2020-10-20T12:00:00Z')

In [156]: not_utc = celtypes.TimestampType('2020-10-20T12:00:00-05:00')

In [157]: utc
Out[157]: TimestampType('2020-10-20T12:00:00Z')

In [158]: not_utc
Out[158]: TimestampType('2020-10-20T12:00:00Z')

In [159]: utc == not_utc
Out[159]: False

In [160]: str(utc) == str(not_utc)
Out[160]: True
@jvolkman jvolkman changed the title TimestampType.__str__ doesn't honor timestamp offset TimestampType.__str__ doesn't honor timezone offset May 7, 2021
@slott56 slott56 added the bug Something isn't working label May 21, 2024
@slott56
Copy link
Collaborator

slott56 commented May 21, 2024

This does seem wrong to ignore an actual timezone and treat it as UTC ("Z")

@slott56 slott56 added this to the 0.3 release milestone May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants