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

Adding `--date' argument to configure time format #235

Merged
merged 3 commits into from
Feb 16, 2023

Conversation

jazcarate
Copy link
Contributor

Summary

--iso8601 was too hard for me to remember, and most often than not I want to see the time in my local timezone

Preflight checklist

  • Code formatted with rustfmt
  • Relevant tests added
  • Any new documentation added

--iso8601 was too hard for me to remember, and most often than not I want to see the time in my local timezone
match parse(&mut parsed, arg, StrftimeItems::new("%#z")) {
Ok(_) => match parsed.offset {
Some(offset) => Ok(TimeFormat::Fixed(offset)),
None => panic!("Should have been able to parse the offset"),
Copy link
Owner

Choose a reason for hiding this comment

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

A better error message would be something long the lines of, "{arg} could not be parsed as a UTC offset"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This panic should never ever happen. The format (%#z) is an offset format, so there is no way parsed.offset is a None.
For example, a format like "%H:%M:%S" has a None offset.

The error when you input something that is not an offset is the Err(_) in the next line

src/cli_config.rs Outdated Show resolved Hide resolved
@mike-engel mike-engel merged commit 4b0dfa3 into mike-engel:main Feb 16, 2023
@mike-engel
Copy link
Owner

Very sorry for the delay, but this is in 6.0.0 now

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.

None yet

2 participants