Skip to content

feat(en): support military time (HHMM) with hours/at/Z markers - #676

Open
smoltafet wants to merge 1 commit into
wanasit:masterfrom
smoltafet:feat/en-military-time
Open

smoltafet wants to merge 1 commit into
wanasit:masterfrom
smoltafet:feat/en-military-time

Conversation

@smoltafet

Copy link
Copy Markdown

Implements #638.

Bare four-digit numbers are intentionally not parsed as times (years - see the guard added for "2019 to 2020"), so this adds a dedicated ENMilitaryTimeParser for the shapes that unambiguously mark a four-digit group as a time of day:

  • 1430 hours, 0930hrs, 0800 hr ("hours" suffix)
  • at 1430, meet at 0930 ("at" prefix)
  • 1430Z, 1430 Z (Zulu designator - also assigns timezoneOffset 0)

The HHMM value is validated (hour 00-23, minute 00-59), so invalid times like at 2460 or at 2500 hours are rejected, and bare numbers (1430, 2019 to 2020) still do not parse. The parser is a small standalone parser per the repo's modular-parser guidance, registered in the EN configuration right after ENTimeExpressionParser, and merges with dates as usual ("On Oct 22 at 1430 hours", "at 0745 tomorrow").

Tests: new test/en/en_military_time.test.ts (individually spelled-out cases per AGENTS.md: suffix/prefix/Zulu forms, date merging, bare-number negatives, invalid-time negatives). Full suite: 159 suites / 759 tests pass; npm run prettier applied.

@smoltafet

Copy link
Copy Markdown
Author

Hi @wanasit, could you take a look at this when you have a chance? Happy to make changes if anything needs work. Thanks!

This branch has not been deployed

No deployments
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.

1 participant