1
0
mirror of https://github.com/robertkrimen/otto synced 2025-10-12 20:27:30 +08:00

Fix Date.parse to parse RFC1123

This commit is contained in:
Robert Krimen 2014-01-25 11:13:30 -08:00
parent 302b2f0cbf
commit def5c4837d
2 changed files with 14 additions and 0 deletions

View File

@ -208,3 +208,15 @@ func TestDate_setMilliseconds(t *testing.T) {
[ abc, def ];
`, "Invalid Date,NaN")
}
func TestDateComparison(t *testing.T) {
Terst(t)
test := runTest()
test(`
var abc = Date();
var def = (new Date()).toString();
[ abc === def, Math.abs(Date.parse(abc) - Date.parse(def)) <= 1000 ];
`, "false,true")
}

View File

@ -266,6 +266,8 @@ var (
"2006T15:04:05.000-0700",
"2006-01T15:04:05.000-0700",
"2006-01-02T15:04:05.000-0700",
Time.RFC1123,
}
matchDateTimeZone = regexp.MustCompile(`^(.*)(?:(Z)|([\+\-]\d{2}):(\d{2}))$`)
)