Skip to content

fix(en): accept a dot after the day number in little-endian dates - #675

Open
ybai08 wants to merge 1 commit into
wanasit:masterfrom
ybai08:fix/en-day-with-trailing-dot
Open

ybai08 wants to merge 1 commit into
wanasit:masterfrom
ybai08:fix/en-day-with-trailing-dot

Conversation

@ybai08

@ybai08 ybai08 commented Oct 18, 2026

Copy link
Copy Markdown

Fixes #283

A dot after the day number ("5. March 2019", common in European-style English) was not accepted by ENMonthNameLittleEndianParser, so the day was dropped or misread:

input before after
5. March 2019, 03:26 PM EDT "March 2019, 03:26 PM EDT", 1 March 2019 15:26 (day lost) whole text, 5 March 2019 15:26 EDT
23. October 2026 1 October 2026 23:00 (23. read as an hour) 23 October 2026
Sunday 15. Sep "Sunday 15", tomorrow 15:00 15 September
10. - 22. August 2012 "22. August 2012", 1 August 2012 22:00 10 - 22 August 2012

The pattern now allows an optional . after the day and after the end day of a range, the same way DEMonthNameLittleEndianParser already does. Nothing else in the pattern changes.

One side effect worth knowing: a numbered list item that starts with a month name, such as 1. May we begin?, now parses as 1 May, the same as 1 May we begin? already does without the dot.

Tests: a new Test - Day number followed by a dot (Issue #283) block in test/en/en_month_name_little_endian.test.ts (four cases, spelled out individually). With the parser change reverted it fails (result.index is 3 instead of 0 for the issue's example). npx jest passes (754 tests), and prettier --check src test and npm run build are clean. npm run eslint was not run: it already fails on master because there is no eslint 9 flat config (#606).

"5. March 2019" lost its day and "23. October" became 1 October at
23:00, because the little-endian pattern did not allow the dot that
often follows the day number. Allow an optional dot after the day and
after the end day of a range.

Fixes wanasit#283

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.

Correctly parse date with dot after day

1 participant