fix(i18n): read a fraction with a decimal numerator as a duration #289
No reviewers
Labels
No labels
bug
discussion
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
research
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gram-lang/gram!289
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/duration-decimal-numerator-fraction"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up noted in #286.
The parser reads a decimal numerator as a fraction (
{1.5/2 cups}is 0.75 cup, conformance case 025, fixed in 1.0.0-beta5), but a timer's duration is read from its raw text byparseDuration(@gram-lang/i18n), whose tokenizer took1.5as a decimal and stopped at the/:~{1.5/2 min}gotINVALID_DURATIONand counted for nothing in the schedule.tokenizeDuration: a decimal followed by/and digits is a fraction (1.5/2,1,5/2). The denominator stays whole and a mixed number needs a whole numerator, as the grammar'splainNumberandmixedFraction(1/2.5 his still refused,1 0.5/2 hourgivesbareNumber).packages/i18n/tests/duration-cases.ts(en + fr; 4 fail without the fix,1/2.5 his a guard), andpackages/kitchen/tests/decimal-numerator-timer.test.ts(simple and proportional timers; both fail without the fix).patchchangeset for@gram-lang/i18nand@gram-lang/kitchen.Checks: 3944 pass / 1 skip / 0 fail, conformance 142/142 and 24/24 with no golden change, typecheck, biome,
deprecations:check, audit 126.Fuzz 50k (seed 1572729094): one
format-idempotentsignature, a regression of #285 already on main, unrelated to this change; fixed in a separate PR.