Skip to content

Commit

Permalink
Merge pull request #73 from nownabe/smbc2
Browse files Browse the repository at this point in the history
Fix SMBC date parser
  • Loading branch information
nownabe authored Jan 23, 2022
2 parents b999136 + 1059279 commit 5380615
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion contrib/handlers/smbc.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

func parseSMBCDate(date string) (time.Time, error) {
t, err := time.Parse("2006/01/02", date)
t, err := time.Parse("2006/1/2", date)
if err == nil {
return t, nil
}
Expand Down
1 change: 1 addition & 0 deletions contrib/handlers/smbc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func Test_parseSMBCDate(t *testing.T) {
{input: "R01.05.01", expect: time.Date(2019, 5, 1, 0, 0, 0, 0, time.UTC), e: false},
{input: "R1.5.2", expect: time.Time{}, e: true},
{input: "2021/12/17", expect: time.Date(2021, 12, 17, 0, 0, 0, 0, time.UTC), e: false},
{input: "2021/1/1", expect: time.Date(2021, 1, 1, 0, 0, 0, 0, time.UTC), e: false},
}

for _, c := range cases {
Expand Down

0 comments on commit 5380615

Please sign in to comment.