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

chrono::DateTime<FixedOffset> doesn't store the offset (timezone) in sqlite as text and timezone information is lost #1617

Closed
05storm26 opened this issue Jan 10, 2022 · 0 comments · Fixed by #1618

Comments

@05storm26
Copy link
Contributor

Currently a chrono::DateTime<FixedOffset> in the Encode trait for sqlite is converted to UTC and stored without an offset.

This causes the timezone/offset information to be lost. SQLite supports timezones in its formats: https://www.sqlite.org/lang_datefunc.html#time_values

We should instead store DateTime<FixedOffset> by converting them to RFC3339 format which is a variant of ISO8601 and SQLITE compatible format (using to_rfc3339_opts) and has time offset information in it.

Similarly we should try to utilize this offset in potentially in the text value in the Decode implementation of DateTime<FixedOffset> by first attemting to use DateTime::parse_from_rfc3339.

@05storm26 05storm26 changed the title chrono::DateTime<FixedOffset> doesn't store the offset (timezone) is sqlite as text and timezone information is lost chrono::DateTime<FixedOffset> doesn't store the offset (timezone) in sqlite as text and timezone information is lost Jan 10, 2022
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 a pull request may close this issue.

1 participant