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:
parent
302b2f0cbf
commit
def5c4837d
12
date_test.go
12
date_test.go
|
@ -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")
|
||||
}
|
||||
|
|
|
@ -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}))$`)
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue
Block a user