Skip to content

Parse dates followed by parameters or other members - #89

Open
wleeaf wants to merge 1 commit into
evert:mainfrom
wleeaf:date-followed-by-more
Open

wleeaf wants to merge 1 commit into
evert:mainfrom
wleeaf:date-followed-by-more

Conversation

@wleeaf

@wleeaf wleeaf commented Oct 26, 2026

Copy link
Copy Markdown

A Date only parses when it is the last thing in the field value. Anything after it fails, so all of these throw Parse error: Expected a digit (0-9), whitespace or EOL:

parseItem('@1659578233;a=1');
parseList('@1659578233, (@0 @-1)');
parseDictionary('a=@1659578233, b=2');

parseDate reads digits until the end of the input and throws on any other character. RFC 9651 section 4.2.9 parses a Date by running "Parsing an Integer or Decimal" on the rest of the input, which stops at the first character that isn't part of the number, and then fails if the result is a Decimal. parseDate now does the same with parseIntegerOrDecimal. That also brings back the 15-digit limit from 2.0.3, and a decimal such as @1659578233.5 still fails.

None of the HTTPWG tests put a Date anywhere but at the end of the field, which is why the suite didn't catch this. I added test/parser-tests.js with these cases in the same style as serializer-tests.js. The three parsing cases fail on main. The HTTPWG tests still pass, and make lint is clean.

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.

1 participant