Skip to content

don't read 'the twenty fifth of december' as a fraction - #1257

Merged
spencermountain merged 1 commit into
spencermountain:devfrom
b84330808:fix-compound-ordinal-of
Nov 2, 2026
Merged

spencermountain merged 1 commit into
spencermountain:devfrom
b84330808:fix-compound-ordinal-of

Conversation

@b84330808

Copy link
Copy Markdown
Contributor

The [#Card+ #Ord] of . fraction rule also caught spelled-out compound ordinals:

nlp('the twenty fifth of december').numbers().get()  // [4]   (20/5)
nlp('the twenty-third of june').numbers().get()      // [6.667]
// with compromise-dates, 'the twenty fifth of december' is december 4th

A fraction with a numerator above one has a plural ordinal ('two thirds of'), and 'one third of' / 'a twenty fifth of' are already covered by the (a|one) rule, so this rule now only takes a plural ordinal. 'two thirds of', 'three fifths of' and 'nine tenths of' are unchanged. Tests added to fractions.test.js and to the dates plugin's explicit-dates test; they fail on dev and pass with the change. The full suite and the plugin suites pass.

I used Claude Code to write this change.

The '[#Card+ #Ord] of .' fraction rule also caught spelled-out compound
ordinals, so 'twenty fifth of' became 20/5 and the dates plugin read
'the twenty fifth of december' as december 4th. A fraction with more
than one part has a plural ordinal ('two thirds of'), and 'one third of'
is already covered by the (a|one) rule, so only match a plural ordinal
here.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@spencermountain

Copy link
Copy Markdown
Owner

hahahaha
thats awesome!
(thank you)

@spencermountain
spencermountain merged commit e25f3ba into spencermountain:dev Nov 2, 2026
1 check passed
@spencermountain spencermountain mentioned this pull request Nov 8, 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