Skip to content

Conversation

@sylvestre
Copy link
Contributor

No description provided.

@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/date/date-tz is no longer failing!

@sylvestre sylvestre marked this pull request as ready for review September 11, 2025 07:19

let output = result.stdout_str();
// Should show the parsed date in UTC timezone
assert!(output.contains("2020-01-01 12:00:00+00:00"));
Copy link
Contributor

@cakebaker cakebaker Sep 11, 2025

Choose a reason for hiding this comment

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

Hm, with GNU date I get a different result:

$ date --rfc-3339=seconds --date='TZ="UTC" 2020-01-01 12:00:00'
2020-01-01 13:00:00+01:00
$ cargo run -q date --rfc-3339=seconds --date='TZ="UTC" 2020-01-01 12:00:00'
2020-01-01 12:00:00+00:00

As I'm in UTC+1, it looks like GNU date gives some local setting a higher priority than the TZ="UTC" in the date string.

Comment on lines +775 to +780
// Also verify with regular format that it doesn't contain 2020
let regular_result = new_ucmd!()
.arg("-d")
.arg("TZ=\"INVALID_TZ\" 2020-01-01")
.succeeds();
assert!(!regular_result.stdout_str().contains("2020"));
Copy link
Contributor

@cakebaker cakebaker Sep 11, 2025

Choose a reason for hiding this comment

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

Here I also get a different result with GNU date as the output contains the specified date:

$ date --date="TZ=\"INVALID_TZ\" 2020-01-01"
Wed Jan  1 01:00:00 AM CET 2020
$ cargo run -q date --date="TZ=\"INVALID_TZ\" 2020-01-01"
Thu Sep 11 10:33:02 CEST 2025

@yuankunzhang
Copy link
Contributor

Isn't this feature more appropriate to be implemented in the parse_datetime crate? The parse_datetime crate already has the infrastructure to make the parsing of the "TZ='timezone'" spec easy.

We are waiting for this PR. Since it has been stalled for some time, I will take up and implement it sometime this weekend.

@sylvestre
Copy link
Contributor Author

@yuankunzhang yeah, good call. thanks :)

@sylvestre sylvestre closed this Oct 21, 2025
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.

3 participants