From 617d62a6a74f2af00bbfb347142221ed590f2cb9 Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Wed, 11 Oct 2023 21:20:45 -0700 Subject: [PATCH] Make millis optional when parsing created_at `created_at` parsing appears to failing, an RSS feed that I subscribe to is re-posting the same content. I believe this is to do the error handling assigning the current timestamp when `created_at` fails to parse. It parsing with a time format that requires millis, but that's not what i see from the search results. (For example, the first hit from https://hn.algolia.com/api/v1/search_by_date?golang currently has `"created_at": "2023-10-12T04:17:00Z"`.) --- algolia.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/algolia.go b/algolia.go index ba2d176..c96bd64 100644 --- a/algolia.go +++ b/algolia.go @@ -117,7 +117,7 @@ func (hit AlgoliaSearchHit) GetDescription() string { } func (hit AlgoliaSearchHit) GetCreatedAt() time.Time { - if rv, err := time.Parse("2006-01-02T15:04:05.000Z", hit.CreatedAt); err == nil { + if rv, err := time.Parse("2006-01-02T15:04:05Z", hit.CreatedAt); err == nil { return rv } else { return UTCNow()