Skip to content

rust: Fix daylight saving inaccuracy#122

Open
bact wants to merge 3 commits into
JPEWdev:mainfrom
bact:fix-rust-dst
Open

rust: Fix daylight saving inaccuracy#122
bact wants to merge 3 commits into
JPEWdev:mainfrom
bact:fix-rust-dst

Conversation

@bact

@bact bact commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

The timezone offset should use the offset of the date in the parsing (input data), not the current date (today). Or it risks to get a wrong offset due to shift from daylight saving time (DST).

Example: Decoding "2024-03-11T01:02:03" (no timezone, before DST started) while running the code today in July (DST active, UTC+1) previously produced 2024-03-11T01:02:03+01:00 which is wrong, since March 11 was actually UTC+0. It now correctly produces 2024-03-11T01:02:03Z.

Note that this issue will not occur with a valid SPDX 3 document since SPDX 3 DateTime requires it "always expressed in UTC time zone" so no DST and no issue. But as shacl2code can be generic, the issue may occurs with non-SPDX use cases.

The timezone offset should use the offset of the date in the parsing (input data), not the current date (today). Or it risks to get a wrong offset due to shift from DST.

Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
@bact bact added the bug Something isn't working label Jul 1, 2026
@bact

bact commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator Author

@stondo please kindly review at your convenience

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

Coverage report

This PR does not seem to contain any modification to coverable code.

@JPEWdev

JPEWdev commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Is ti possible to add a test for this?

@bact

bact commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator Author

Will add tests, thanks

@bact bact marked this pull request as draft July 1, 2026 17:47
bact added 2 commits July 1, 2026 21:41
Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
@bact bact marked this pull request as ready for review July 2, 2026 02:02
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

Successfully merging this pull request may close these issues.

2 participants