Skip to content

feat(en): support end-of-period expressions - #654

Open
martinfrancois wants to merge 2 commits into
wanasit:masterfrom
martinfrancois:fix/issue-521-end-of-period
Open

feat(en): support end-of-period expressions#654
martinfrancois wants to merge 2 commits into
wanasit:masterfrom
martinfrancois:fix/issue-521-end-of-period

Conversation

@martinfrancois

@martinfrancois martinfrancois commented Aug 1, 2026

Copy link
Copy Markdown

Summary

Adds casual English support for end of … and last day of … expressions. The parser now resolves the complete expression to the final calendar day of a current, named, or relative period.

Closes #521

Supported Expressions

The new behavior covers:

  • Current month expressions such as end of the month and last day of month.
  • Named months such as end of July and last day of July.
  • Relative periods such as end of next week, end of next month, and end of next year.
  • Named months with explicit or relative years, such as end of February 2024, end of October next year, and end of october 2032.
  • this, last, past, and next modifiers for relative weeks, months, and years.

The complete expression is included in the parse result, with correct handling for 30- and 31-day months, leap years, and closest-year inference when a named month has no explicit year.

Implementation

  • Add ENEndOfCurrentMonthParser for current-month expressions.
  • Add ENEndOfRelativePeriodParser for relative week, month, and year expressions.
  • Add ENEndOfMonthRefiner for named months and relative-year suffixes.
  • Register the new parser and refiner components in the casual English configuration.
  • Add coverage for current, named, relative, explicit-year, relative-year, leap-year, case-insensitive, and closest-year scenarios.

How to Verify

  1. Parse last day of July, end of the month, end of next week, end of next month, end of next year, end of October next year, and end of october 2032 with the default English parser.
  2. Confirm each result spans the complete expression and resolves to the period's final calendar day.
  3. Run npm run test:silent -- --runInBand and npm run build.

Test Plan

  • Added coverage for the supported end-of-period expressions
  • Full suite passes: 146 suites / 676 tests
  • CommonJS and ESM builds pass
  • Changed files pass Prettier checks
  • Codex review reports no remaining findings

Risk Assessment

Low — the behavior is limited to the casual English configuration and requires an explicit end of or last day of expression.

Support 'end of' and 'last day of' for named and current months, including leap years and closest-year inference.

Fixes wanasit#521.
@martinfrancois
martinfrancois force-pushed the fix/issue-521-end-of-period branch from 2b36a65 to 380da48 Compare August 1, 2026 14:40
@martinfrancois martinfrancois changed the title fix(en): parse end-of-month expressions fix(en): parse end-of-period expressions Aug 1, 2026
@martinfrancois martinfrancois changed the title fix(en): parse end-of-period expressions feat(en): support end-of-period expressions Aug 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.

Last day of month/End of month not parsed

1 participant