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

Date range checking #160

Merged
merged 8 commits into from
Mar 30, 2024
Merged

Date range checking #160

merged 8 commits into from
Mar 30, 2024

Conversation

tiffany352
Copy link
Owner

Dates have no range checking which makes parsing them slightly unreliable and causes weird error messages like this:

> #25:00#
Most likely pattern `hour12:min[:sec] meridiem[ offset]` failed: Expected ` `, got eof

Additionally, large numbers cause a panic:

> #9999999999#
Panic: The application panicked (crashed).
Message:  called `Result::unwrap()` on an `Err` value: ParseIntError { kind: PosOverflow }
Location: core/src/parsing/datetime.rs:117

Backtrace omitted.
Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

This PR adds range checks. I also cleaned up the code a little.

@tiffany352 tiffany352 merged commit 01be58b into master Mar 30, 2024
2 checks passed
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.

1 participant