From 98123f6fa22f84fae265bf185084dccccb220fc5 Mon Sep 17 00:00:00 2001 From: egawata Date: Wed, 30 Mar 2022 23:29:23 +0900 Subject: [PATCH] fix: convert time.Time to toml representation properly --- storage/toml.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/storage/toml.go b/storage/toml.go index 6f86ee5..f77365e 100644 --- a/storage/toml.go +++ b/storage/toml.go @@ -4,6 +4,7 @@ import ( "bytes" "fmt" "github.com/pelletier/go-toml" + "time" ) func init() { @@ -66,6 +67,8 @@ func (p *TOMLParser) ToBytes(value interface{}, options ...ReadWriteOption) ([]b } } } + case time.Time: + buf.Write([]byte(fmt.Sprintf("%s\n", d.Format(time.RFC3339)))) default: if err := enc.Encode(d); err != nil { if err.Error() == "Only a struct or map can be marshaled to TOML" {