From 7dc97f2b886e88f23bcf46901d3ca7706db76fd1 Mon Sep 17 00:00:00 2001 From: Julio Gutierrez Date: Mon, 10 Jul 2023 23:28:58 -0500 Subject: [PATCH] Avoid milisec --- lib/dockerhub/tags.go | 2 +- lib/dockerhub/tags_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/dockerhub/tags.go b/lib/dockerhub/tags.go index b10b4bc..b3f06bb 100644 --- a/lib/dockerhub/tags.go +++ b/lib/dockerhub/tags.go @@ -23,7 +23,7 @@ func (t *Time) UnmarshalJSON(data []byte) error { if len(data) <= 4 { return nil } - vt, err := time.Parse("2006-01-02T15:04:05.00", string(data)[1:23]) + vt, err := time.Parse("2006-01-02T15:04:05", string(data)[1:20]) if err == nil { *t = Time(vt) } diff --git a/lib/dockerhub/tags_test.go b/lib/dockerhub/tags_test.go index d65f31b..10db012 100644 --- a/lib/dockerhub/tags_test.go +++ b/lib/dockerhub/tags_test.go @@ -83,7 +83,7 @@ func TestTime_UnmarshalJSON(t *testing.T) { }{ {"Null", "null", Time{}}, {"Empty", "", Time{}}, - {"Parsing", "\"2019-06-08T17:34:35.543678\"", Time(time.Date(2019, time.June, 8, 17, 34, 35, 540000000, time.UTC))}, + {"Parsing", "\"2019-06-08T17:34:35.543678\"", Time(time.Date(2019, time.June, 8, 17, 34, 35, 000000000, time.UTC))}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {