Commit Graph
4 Commits
Author SHA1 Message Date
dualfroz fa0fa5b55b feat(rules): add an opt-in timezone rule (#23)
common.Timezone matches UTC and GMT with an optional offset (UTC+2,
GMT-05:30, GMT+0530) and a small table of upper case abbreviations
(EST, PDT, CET, ...), and sets Context.Location, so "10 pm EST" comes back
as 22:00 in a -05:00 zone. A timezone alone does not count as a match.
It is not added to common.All, so existing parsers behave as before.
2026-10-03 02:49:55 +02:00
dualfroz c2384ff7ad feat(rules): add the aggressive deadline option to nl and br 2026-10-03 01:52:53 +02:00
dualfroz 52f50c7639 feat(rules): make in/within optional in the en deadline rule 2026-10-02 16:04:11 +02:00
dualfroz d98b8ffe43 fix(rules): keep parsed month from overflowing into the next one (#50)
Context.Time applied the parsed month while the day was still the one of
the reference date. When that day does not exist in the target month,
time.Date normalizes it forward, so "september 5th" parsed on the 31st
of October resolved to the 5th of October. The parsed day was only
applied afterwards, to the already wrong month.

Clamp the reference day to the last day of the target month before
switching the month. The parsed day still overwrites it afterwards, so
the ordering of the branches in Context.Time is unchanged.

The existing fixtures pin the reference date to 2016-01-06 and the 6th
exists in every month, so the overflow never triggered. Add a regression
test that parses against 2016-10-31.

Fixes #12
2026-09-27 20:38:39 +10:00