Skip to content

Commit c7e606b

Browse files
Wednesday support for RFC 850 (#1225)
1 parent 6b47f20 commit c7e606b

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/impl/regexParser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ function preprocessRFC2822(s) {
234234
const rfc1123 =
235235
/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,
236236
rfc850 =
237-
/^(Monday|Tuesday|Wedsday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,
237+
/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,
238238
ascii =
239239
/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;
240240

test/datetime/regexParse.test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,20 @@ test("DateTime.fromHTTP() can parse RFC 850", () => {
814814
});
815815
});
816816

817+
test("DateTime.fromHTTP() can parse RFC 850 on Wednesday", () => {
818+
const dt = DateTime.fromHTTP("Wednesday, 29-Jun-22 08:49:37 GMT");
819+
expect(dt.isValid).toBe(true);
820+
expect(dt.toUTC().toObject()).toEqual({
821+
year: 2022,
822+
month: 6,
823+
day: 29,
824+
hour: 8,
825+
minute: 49,
826+
second: 37,
827+
millisecond: 0,
828+
});
829+
});
830+
817831
test("DateTime.fromHTTP() can parse ASCII dates with one date digit", () => {
818832
const dt = DateTime.fromHTTP("Sun Nov 6 08:49:37 1994");
819833
expect(dt.isValid).toBe(true);

0 commit comments

Comments
 (0)