Skip to content

Commit 42c543c

Browse files
authored
Support whitespace between date and time component (#29)
* Support whitespace between date and time component * Update CI workflow
1 parent b9fe72e commit 42c543c

File tree

3 files changed

+25
-15
lines changed

3 files changed

+25
-15
lines changed

.github/workflows/verify.yml

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
name: Verify
22

3-
on: [push]
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
pull_request:
49

510
jobs:
611
go-vet-lint-test:
@@ -9,7 +14,7 @@ jobs:
914
- uses: actions/checkout@v3
1015

1116
- name: Set up Go
12-
uses: actions/setup-go@v3
17+
uses: actions/setup-go@v5
1318
with:
1419
go-version: stable
1520

@@ -19,23 +24,16 @@ jobs:
1924
- name: Run go vet
2025
run: go vet ./...
2126

22-
- name: Install staticcheck
23-
run: go install honnef.co/go/tools/cmd/staticcheck@latest
24-
25-
- name: Run staticcheck
26-
run: staticcheck ./...
27-
28-
- name: Install golint
29-
run: go install golang.org/x/lint/golint@latest
30-
31-
- name: Run golint
32-
run: golint ./...
27+
- name: golangci-lint
28+
uses: golangci/golangci-lint-action@v6
29+
with:
30+
version: v1.64
3331

3432
- name: Run tests
3533
run: go test -race -vet=off -json ./... > TestResults.json
3634

3735
- name: Upload Go test results
38-
uses: actions/upload-artifact@v3
36+
uses: actions/upload-artifact@v4
3937
with:
4038
name: Go-test-results
4139
path: TestResults.json

iso8601.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ parse:
164164
return time.Time{}, err
165165
}
166166
break parse
167-
case 'T':
167+
case 'T', ' ':
168168
if p != day {
169169
return time.Time{}, newUnexpectedCharacterError(inp[i])
170170
}

iso8601_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,18 @@ var cases = []TestCase{
299299
MilliSecond: 0,
300300
Zone: 0,
301301
},
302+
{
303+
Using: "2017-04-24 09:41:34",
304+
Year: 2017, Month: 4, Day: 24,
305+
Hour: 9, Minute: 41, Second: 34,
306+
},
307+
{
308+
Using: "2017-04-24 09:41:34.502+00:00",
309+
Year: 2017, Month: 4, Day: 24,
310+
Hour: 9, Minute: 41, Second: 34,
311+
MilliSecond: 502,
312+
Zone: 0,
313+
},
302314

303315
// Invalid Parse Test Cases
304316
{

0 commit comments

Comments
 (0)