You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"<time> utc + 1 hour" is read as a UTC+1 offset instead of adding an hour #28
After utc or gmt, a spaced + N / - N is taken as a UTC offset. So adding a duration to a UTC time doesn't add it: the number becomes an offset and the unit after it is dropped. The displayed result even looks correct, which hides the problem.
Verified on main @ 42dcb73, with the host zone frozen to UTC:
Input
numen
Expected
2026-01-18 14:30 utc + 1 hour
15:30:00 (Etc/UTC+1)
15:30:00 (Etc/UTC)
2026-01-18 14:30 utc + 1 hour to epoch
1,768,746,600 (= 14:30Z, unchanged)
1,768,750,200 (= 15:30Z)
2026-01-18 14:30 utc - 2 hours to epoch
1,768,746,600
1,768,739,400
same as the first row, in strict mode
Unknown token: hour
15:30:00 (Etc/UTC)
Cause:Parser::parseTimezone() (src/numen/parser.cpp:694) calls parseTimezoneOffset() right after utc/gmt. That function accepts a +/- token followed by any integer from 0 to 23, whatever the whitespace. + 1 is consumed as the offset, then hour is skipped in normal mode or rejected in strict mode.
Possible small fix: only read an offset when the sign is glued to the zone name (utc+2, utc-3:15), so utc + 1 hour stays an addition. Draft PR #23 applies the same "sign must be glued" rule to the ISO 8601 path.
Note: this is separate from the offset-direction bug in #27. Here the offset shouldn't be parsed at all.
Activity