feat: date parse with slashes (#490)

Add support for parsing date times with slashes.

Fixes #489

Also:
* Disable G307 for read only files.
* Add missing yaml tag to jsType.
This commit is contained in:
Steven Hartland
2023-05-22 17:23:07 +01:00
committed by GitHub
parent f987875222
commit 922144077c
2 changed files with 8 additions and 0 deletions

View File

@@ -30,6 +30,10 @@ func TestDate(t *testing.T) {
test(`Date`, "function Date() { [native code] }")
test(`new Date(0).toUTCString()`, "Thu, 01 Jan 1970 00:00:00 GMT")
test(`new Date(0).toGMTString()`, "Thu, 01 Jan 1970 00:00:00 GMT")
test(`new Date('2023').toGMTString()`, "Sun, 01 Jan 2023 00:00:00 GMT")
test(`new Date('2023/02').toGMTString()`, "Wed, 01 Feb 2023 00:00:00 GMT")
test(`new Date('2023/02/23').toGMTString()`, "Thu, 23 Feb 2023 00:00:00 GMT")
test(`new Date('2023/02/23 11:23:57').toGMTString()`, "Thu, 23 Feb 2023 11:23:57 GMT")
if false {
// TODO toLocale{Date,Time}String
test(`new Date(0).toLocaleString()`, "")

View File

@@ -235,6 +235,10 @@ var (
"2006-01T15:04:05",
"2006-01-02T15:04:05",
"2006/01",
"2006/01/02",
"2006/01/02 15:04:05",
"2006T15:04:05.000",
"2006-01T15:04:05.000",
"2006-01-02T15:04:05.000",