Skip to content

Commit

Permalink
Remove railsTimeLayout from ParseDateStringAsTime (#4333)
Browse files Browse the repository at this point in the history
  • Loading branch information
DingDongSoLong4 authored Dec 1, 2023
1 parent d24b52a commit d4ef182
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 8 deletions.
1 change: 0 additions & 1 deletion internal/api/timestamp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ func TestTimestamp(t *testing.T) {
{"rfc3339", "2021-11-04T01:02:03Z", "2021-11-04T01:02:03Z"},
{"date", "2021-04-05", "2021-04-05T00:00:00Z"},
{"datetime", "2021-04-05 14:45:36", "2021-04-05T14:45:36Z"},
{"datetime-tz", "2021-04-05 14:45:36 PDT", "2021-04-05T14:45:36Z"},
}

for _, tc := range testCases {
Expand Down
7 changes: 0 additions & 7 deletions pkg/utils/date.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (
"time"
)

const railsTimeLayout = "2006-01-02 15:04:05 MST"

func ParseDateStringAsTime(dateString string) (time.Time, error) {
// https://stackoverflow.com/a/20234207 WTF?

Expand All @@ -25,10 +23,5 @@ func ParseDateStringAsTime(dateString string) (time.Time, error) {
return t, nil
}

t, e = time.Parse(railsTimeLayout, dateString)
if e == nil {
return t, nil
}

return time.Time{}, fmt.Errorf("ParseDateStringAsTime failed: dateString <%s>", dateString)
}

0 comments on commit d4ef182

Please sign in to comment.