Skip to content

Conversation

ffuugoo
Copy link
Contributor

@ffuugoo ffuugoo commented Jul 29, 2025

DateTimeWrapper could not parse it's own to_string output. Oops. Fixed now.

All Submissions:

  • Contributions should target the dev branch. Did you create your branch from dev?
  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests?
  2. Have you formatted your code locally using cargo +nightly fmt --all command prior to submission?
  3. Have you checked your code using cargo clippy --all --all-features command?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

ffuugoo added 3 commits July 29, 2025 12:05
Parse default `chrono::DateTime::to_string` format
...to ensure `DateTimeWrapper::from_str` can successfully parse `DateTimeWrapper::to_string` output
@ffuugoo ffuugoo changed the base branch from master to dev July 29, 2025 10:12
@ffuugoo ffuugoo requested review from timvisee, generall and coszio July 29, 2025 10:12
Comment on lines +84 to +90
ParsedExpression::Datetime(DatetimeExpression::Constant(dt_str.parse().map_err(
|err: chrono::ParseError| {
CollectionError::bad_input(format!(
"failed to parse date-time {dt_str:?}: {err}"
))
},
)?))
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 change is optional, but would have been nice to have better errors during parsing. Would have trivialized solving this issue even more.

Comment on lines +102 to +103
// Attempt to parse default to-string format
.or_else(|_| chrono::DateTime::from_str(s))
Copy link
Contributor Author

@ffuugoo ffuugoo Jul 29, 2025

Choose a reason for hiding this comment

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

According to chrono documentation, FromStr implementation:

Accepts a relaxed form of RFC3339. A space or a ‘T’ are accepted as the separator between the date and time parts. Additional spaces are allowed between each component.

Which seems exactly what we want here? Maybe we can even put this as the first parser we try, before even parse_from_rfc3339.

@ffuugoo ffuugoo marked this pull request as ready for review July 29, 2025 10:19

This comment was marked as resolved.

@ffuugoo ffuugoo merged commit 430b792 into dev Jul 29, 2025
16 checks passed
@ffuugoo ffuugoo deleted the fix-date-time-wrapper-parsing branch July 29, 2025 10:41
timvisee pushed a commit that referenced this pull request Aug 11, 2025
@timvisee timvisee mentioned this pull request Aug 11, 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.

2 participants