Skip to content

Commit ce326f3

Browse files
authored
Merge pull request #97 from chenz4027/align-filter-format
fix: add date format used by AWS for CreateTime on ASGs
2 parents d67e9a8 + 5f60e06 commit ce326f3

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

pkg/filter/filter.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,8 @@ func parseDate(input string) (time.Time, error) {
361361
formats := []string{"2006-01-02",
362362
"2006/01/02",
363363
"2006-01-02T15:04:05Z",
364-
time.RFC3339Nano, // Format of t.MarshalText() and t.MarshalJSON()
364+
"2006-01-02 15:04:05 -0700 MST", // Date format used by AWS for CreateTime on ASGs
365+
time.RFC3339Nano, // Format of t.MarshalText() and t.MarshalJSON()
365366
time.RFC3339,
366367
}
367368
for _, f := range formats {

pkg/filter/filter_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,7 @@ func TestFilter_UnmarshalFilter(t *testing.T) {
414414
future.Format("2006-01-02"),
415415
future.Format("2006/01/02"),
416416
future.Format("2006-01-02T15:04:05Z"),
417+
future.Format("2006-01-02 15:04:05.000 +0000 UTC"),
417418
future.Format(time.RFC3339Nano),
418419
future.Format(time.RFC3339),
419420
},
@@ -422,6 +423,7 @@ func TestFilter_UnmarshalFilter(t *testing.T) {
422423
past.Format("2006-01-02"),
423424
past.Format("2006/01/02"),
424425
past.Format("2006-01-02T15:04:05Z"),
426+
past.Format("2006-01-02 15:04:05.14 -0700 MST"),
425427
past.Format(time.RFC3339Nano),
426428
past.Format(time.RFC3339),
427429
},

0 commit comments

Comments
 (0)