Bug 1617562 Comment 5 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

With numeric dashed dates being added in bug 1557650, we're encountering the same issue with day of week prefixes. Since I think both of these issues could (should) be fixed with the same patch, I won't open a separate bug for it.

This is happening because these dashed date formats defer to separate functions [`TryParseDashedDatePrefix`](https://searchfox.org/mozilla-central/rev/7d77ff808f8407a3e4fc0911779da446c050f9ee/js/src/jsdate.cpp#1142-1145) (and, being added, `TryParseNumericDashedDatePrefix`) which try to parse out the format from the beginning of the string. If this fails, the rest of `ParseDate` continues to run, resulting in the bugged out negative year that you see here, since ParseDate does this when faced with a dashed date that wasn't accepted by `TryParseDashedDatePrefix` (like in bug 1858851). For the numeric dashed dates, the format with a weekday gets rejected entirely, but these are different symptoms of the same problem; the day of week needs to be parsed out before the dashed date prefix.
With numeric dashed dates added in bug 1557650, we're encountering the same issue with day of week prefixes. Since I think both of these issues could (should) be fixed with the same patch, I won't open a separate bug for it.

This is happening because these dashed date formats defer to separate functions [`TryParseDashedDatePrefix`](https://searchfox.org/mozilla-central/source/js/src/jsdate.cpp#1148-1151) and [`TryParseNumericDashedDatePrefix`](https://searchfox.org/mozilla-central/source/js/src/jsdate.cpp#1243-1246) which try to parse out the format from the beginning of the string. If this fails, the rest of `ParseDate` continues to run, resulting in the bugged out negative year that you see here, since ParseDate does this when faced with a dashed date that wasn't accepted by `TryParseDashedDatePrefix` (like in bug 1858851). For the numeric dashed dates, the format with a weekday gets rejected entirely, but these are different symptoms of the same problem; the day of week needs to be parsed out before the dashed date prefix.
With numeric dashed dates added in bug 1557650, we're encountering the same issue with day of week prefixes. Since I think both of these issues could (should) be fixed with the same patch, I won't open a separate bug for it.

This is happening because these dashed date formats defer to separate functions [`TryParseDashedDatePrefix`](https://searchfox.org/mozilla-central/rev/40d51bef58b8e901d6ab4b60dd280f372a0e417d/js/src/jsdate.cpp#1148-1151) and [`TryParseNumericDashedDatePrefix`](https://searchfox.org/mozilla-central/rev/40d51bef58b8e901d6ab4b60dd280f372a0e417d/js/src/jsdate.cpp#1243-1246) which try to parse out the format from the beginning of the string. If this fails, the rest of `ParseDate` continues to run, resulting in the bugged out negative year that you see here, since ParseDate does this when faced with a dashed date that wasn't accepted by `TryParseDashedDatePrefix` (like in bug 1858851). For the numeric dashed dates, the format with a weekday gets rejected entirely, but these are different symptoms of the same problem; the day of week needs to be parsed out before the dashed date prefix.

Back to Bug 1617562 Comment 5