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

Fix timezone in datetime parsing #1982

Merged
merged 1 commit into from
Jan 16, 2024
Merged

Fix timezone in datetime parsing #1982

merged 1 commit into from
Jan 16, 2024

Conversation

Wauplin
Copy link
Contributor

@Wauplin Wauplin commented Jan 15, 2024

Fix #1976.

As reported by @jamesbraza in #1976, our datetime parsing method is not correct. The string returned by the server is timezoned to UTC. In the current code, we use astimezone to explicitly set the timezone when parsing the datetime. However this method is dependent on the local machine time. This PR fixes this by assigning explicitly the UTC timezone, without updating to local time.

We didn't catch the error earlier most likely due to servers already been in UTC. Thanks @jamesbraza for reporting!

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Contributor

@jamesbraza jamesbraza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks!

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that's a nice catch! LGTM!

@Wauplin
Copy link
Contributor Author

Wauplin commented Jan 16, 2024

Thanks both for the review! :)

@Wauplin Wauplin merged commit 5e3b603 into main Jan 16, 2024
16 checks passed
@Wauplin Wauplin deleted the 1976-fix-timezone-parsing branch January 16, 2024 08:37
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

Successfully merging this pull request may close these issues.

test_from_raw_initialization seems to be missing daylight savings?
4 participants