Add ISO ordinal and week-date parsing#45
Conversation
|
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). |
There was a problem hiding this comment.
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")andDate::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.
|
Choir: comment-only review received — routed to |
|
Choir: GitHub Copilot issue-thread comment observed on PR — parent notified with updated gate snapshot (not merge approval). |
|
Choir: comment-only review received — routed to |
|
Choir: fixes pushed by |
|
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). |
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 --checkmoon test --target wasm-gcmoon test --target jsmoon test --target native