Skip to content

test: use isoformat() to compare dates with timezone information#172

Merged
potiuk merged 2 commits into
pallets-eco:mainfrom
bdrung:isoformat
Jun 24, 2025
Merged

test: use isoformat() to compare dates with timezone information#172
potiuk merged 2 commits into
pallets-eco:mainfrom
bdrung:isoformat

Conversation

@bdrung

@bdrung bdrung commented Jun 24, 2025

Copy link
Copy Markdown
Contributor

The date 2017-10-29 02:00 is ambiguous for Europe/Warsaw. It can be UTC+1 or UTC+2.

To make the test case easier to read, test all dates during the DST transition starting with an unambiguous date.

datetime will ignore the UTC offset when comparing dates that have the same timezone. So comparing dates with timezone information require to compare the UTC offset in addition.

Use isoformat() to compare dates with timezone information.

bdrung added 2 commits June 24, 2025 11:48
The date 2017-10-29 02:00 is ambiguous for Europe/Warsaw. It can be
UTC+1 or UTC+2.

To make the test case easier to read, test all dates during the DST
transition starting with an unambiguous date.
`datetime` will ignore the UTC offset when comparing dates that have the
same timezone. So comparing dates with timezone information require to
compare the UTC offset in addition.

Use `isoformat()` to compare dates with timezone information.

@potiuk potiuk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Indeed. BTW ARE YOU IN Warsaw? We should meet :)

@potiuk potiuk merged commit 8704f86 into pallets-eco:main Jun 24, 2025
7 checks passed
@bdrung bdrung deleted the isoformat branch June 24, 2025 10:24
@bdrung

bdrung commented Jun 24, 2025

Copy link
Copy Markdown
Contributor Author

Nope, I am in Berlin. :)

@potiuk

potiuk commented Jun 24, 2025

Copy link
Copy Markdown
Contributor

Nope, I am in Berlin. :)

Next time at FOSS Backstage, Berlin Buzzwords - I never miss those two.

@bdrung

bdrung commented Jun 24, 2025

Copy link
Copy Markdown
Contributor Author

Another FOSS conference in Berlin that I wasn't aware of!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants