From d4ef18287179a99adb4ed15ecbf2e6a27ef87f87 Mon Sep 17 00:00:00 2001 From: DingDongSoLong4 <99329275+DingDongSoLong4@users.noreply.github.com> Date: Fri, 1 Dec 2023 22:28:38 +0200 Subject: [PATCH] Remove railsTimeLayout from ParseDateStringAsTime (#4333) --- internal/api/timestamp_test.go | 1 - pkg/utils/date.go | 7 ------- 2 files changed, 8 deletions(-) diff --git a/internal/api/timestamp_test.go b/internal/api/timestamp_test.go index 35c9bd03c..a36660346 100644 --- a/internal/api/timestamp_test.go +++ b/internal/api/timestamp_test.go @@ -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 { diff --git a/pkg/utils/date.go b/pkg/utils/date.go index 9d3affcf2..de5566e4d 100644 --- a/pkg/utils/date.go +++ b/pkg/utils/date.go @@ -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? @@ -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) }