From b2c42e7a7b4af51df80bc779b86dcaa5848617d2 Mon Sep 17 00:00:00 2001 From: elvis Date: Fri, 20 Oct 2023 17:06:31 +0800 Subject: [PATCH] fix time parse error (#37) (#38) --- kemono/type.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kemono/type.go b/kemono/type.go index 85e39ae..8f20509 100644 --- a/kemono/type.go +++ b/kemono/type.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" "github.com/elvis972602/kemono-scraper/utils" + "github.com/spf13/cast" "net/url" "path/filepath" "time" @@ -110,9 +111,9 @@ type PostRaw struct { func (p PostRaw) ParasTime() Post { var post Post - post.Added, _ = time.Parse(time.RFC1123, p.Added) - post.Edited, _ = time.Parse(time.RFC1123, p.Edited) - post.Published, _ = time.Parse(time.RFC1123, p.Published) + post.Added, _ = cast.StringToDate(p.Added) + post.Edited, _ = cast.StringToDate(p.Edited) + post.Published, _ = cast.StringToDate(p.Published) post.Id = p.Id post.Service = p.Service post.Title = p.Title