When parsing a date string that contains a weekday name followed by a relative duration (for example, "Saturday in 3 weeks"), the parser returns a single merged result where the reported weekday contradicts the computed…
When parsing a date string that contains a weekday name followed by a relative duration (for example, "Saturday in 3 weeks"), the parser returns a single merged result where the reported weekday contradicts the computed calendar date.
"Saturday in 3 weeks" using the standard parser..date() and the weekday value using .get("weekday").The parser should not merge the weekday and the relative duration into a single inconsistent result. Instead, it should return separate consistent results:
"Saturday" (resolving to Saturday, June 27, 2026; weekday 6)"in 3 weeks" (resolving to Wednesday, July 15, 2026; weekday 3)A single merged result is returned:
"Saturday in 3 weeks"2026-07-15 (which is a Wednesday)6 (Saturday)The reported weekday (Saturday) directly contradicts the computed calendar date (Wednesday).
This issue occurs because the weekday component refiner incorrectly merges the leading weekday into the relative-offset date. Since relative-offset dates already resolve their own day-of-week, stamping the leading weekday onto them creates an inconsistent result. This affects other relative patterns such as [weekday] within [duration] or [weekday] in N days.
Adapted from wanasit/chrono (MIT).
Visible test command
TZ=UTC npx --no-install jest --ci --coverage=falseThe repository’s own tests. Run all tests includes them, and so does every submission.
Repository
contradictory-weekday-relative-offset
Changes under src/ are evaluated.