Skip to content

Make sure duration parsing/date modification works with DateTimes - #6

Merged
fbacall merged 2 commits into
masterfrom
datetime-durations
Sep 9, 2026
Merged

fbacall merged 2 commits into
masterfrom
datetime-durations

Conversation

@fbacall

@fbacall fbacall commented Sep 9, 2026

Copy link
Copy Markdown
Member

Fixes #4
Fixes #5

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new duration parsing currently coerces all duration components to floats, which can lead to surprising numeric coercions/precision in date arithmetic and should be corrected for predictable behavior.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR updates duration parsing and date modification logic so ISO8601 durations that include only a time component (e.g., PT1H) are accepted, and so modify_date preserves time information when the start value is a datetime.

Changes:

  • Update modify_date to parse full ISO8601 durations including PT... time-only values and to use DateTime when the input date string includes a time component.
  • Add a regression test ensuring end datetime is correctly inferred from a start datetime plus a time-only duration (PT8H).
File summaries
File Description
test/field_test.rb Adds coverage for inferring an end datetime from a start datetime and an ISO8601 PT... duration.
lib/tess/rdf/extraction.rb Reworks modify_date duration parsing and applies calendar vs fixed-unit arithmetic, preserving time when appropriate.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lib/tess/rdf/extraction.rb Outdated
@fbacall
fbacall merged commit 28bc0b7 into master Sep 9, 2026
6 checks passed
@fbacall
fbacall deleted the datetime-durations branch September 9, 2026 17:40
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.

modify_date does not include time Duration parsing is wrong

2 participants