Skip to content

Add ISO ordinal and week-date parsing#45

Merged
brickfrog merged 2 commits into
mainfrom
main.ergo-task-add-iso-8601-1780418501483-596086
Jun 2, 2026
Merged

Add ISO ordinal and week-date parsing#45
brickfrog merged 2 commits into
mainfrom
main.ergo-task-add-iso-8601-1780418501483-596086

Conversation

@brickfrog

Copy link
Copy Markdown
Owner

Closes tempo-bra.4.\n\nAdds strict Date::parse_ordinal and Date::parse_iso_week parsers that mirror the existing format_ordinal and format_iso_week outputs for 4-digit years. Both parsers reuse the existing Date constructors for calendar validation and reject malformed input, trailing characters, and out-of-range ordinal/week fields.\n\nVerification:\n- moon fmt --check\n- moon test --target wasm-gc\n- moon test --target js\n- moon test --target native

Verification

Generated by Choir from commands executed in the leaf workspace.

  • moon fmt --check
    • exit: 0
    • head: 2929759
    • output tail:
Finished. moon: no work to do
  • moon test --target wasm-gc
    • exit: 0
    • head: 2929759
    • output tail:
Total tests: 288, passed: 288, failed: 0.
  • moon test --target js
    • exit: 0
    • head: 2929759
    • output tail:
Total tests: 288, passed: 288, failed: 0.
  • moon test --target native
    • exit: 0
    • head: 2929759
    • output tail:
Total tests: 288, passed: 288, failed: 0.

@brickfrog

Copy link
Copy Markdown
Owner Author

Choir: GitHub Actions rollup reports all checks successful on the latest head — re-check review/merge policy on GitHub (not an approval or merge signal by itself).

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.

Pull request overview

This PR adds strict ISO 8601 parsing helpers for ordinal dates and ISO week-dates, aligning with the library’s existing formatting helpers for 4-digit years and using existing Date constructors to validate calendar correctness.

Changes:

  • Add Date::parse_ordinal("YYYY-DDD") and Date::parse_iso_week("YYYY-Www-D") with full-input consumption (no trailing characters).
  • Add unit tests covering valid round-trips and malformed/out-of-range rejection for both parsers.
  • Expose the new public APIs in the generated package interface.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/tempo.mbt Adds the two new strict date parsers that delegate validation to existing Date constructors.
src/tempo_test.mbt Adds round-trip and rejection tests for ordinal and ISO week-date parsing.
src/pkg.generated.mbti Publishes the new parser functions in the package’s generated public surface.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/tempo.mbt
Comment thread src/tempo.mbt
@brickfrog

Copy link
Copy Markdown
Owner Author

Choir: comment-only review received — routed to main.ergo-task-add-iso-8601-1780418501483-596086 (leaf pane).

@brickfrog

Copy link
Copy Markdown
Owner Author

Choir: GitHub Copilot issue-thread comment observed on PR — parent notified with updated gate snapshot (not merge approval).

@brickfrog

Copy link
Copy Markdown
Owner Author

Choir: comment-only review received — routed to main.ergo-task-add-iso-8601-1780418501483-596086 (leaf pane).

@brickfrog

Copy link
Copy Markdown
Owner Author

Choir: fixes pushed by main.ergo-task-add-iso-8601-1780418501483-596086 — resolving threads and checking gates (not merged yet).

@brickfrog

Copy link
Copy Markdown
Owner Author

Choir: GitHub Actions rollup reports all checks successful on the latest head — re-check review/merge policy on GitHub (not an approval or merge signal by itself).

@brickfrog brickfrog merged commit 93e5523 into main Jun 2, 2026
2 checks passed
@brickfrog brickfrog deleted the main.ergo-task-add-iso-8601-1780418501483-596086 branch June 2, 2026 16:51
@brickfrog brickfrog mentioned this pull request Jun 2, 2026
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