Skip to content

Commit

Permalink
feat: date parse with slashes (#490)
Browse files Browse the repository at this point in the history
Add support for parsing date times with slashes.

Fixes #489

Also:
* Disable G307 for read only files.
* Add missing yaml tag to jsType.
  • Loading branch information
stevenh authored May 22, 2023
1 parent f987875 commit 9221440
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions date_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()`, "")
Expand Down
4 changes: 4 additions & 0 deletions type_date.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 9221440

Please sign in to comment.