Skip to content

Commit

Permalink
update gen.Config.getTimeFormat internals
Browse files Browse the repository at this point in the history
  • Loading branch information
alehechka committed Jul 1, 2022
1 parent b77ab5c commit 7456023
Showing 1 changed file with 2 additions and 41 deletions.
43 changes: 2 additions & 41 deletions gen/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"time"

"github.com/alehechka/json2go/jenshared"
"github.com/alehechka/json2go/utils"
)

// Config presents Gen configurations.
Expand Down Expand Up @@ -65,45 +66,5 @@ func (c *Config) prepareOutputFileName() {
}

func (c *Config) getTimeFormat() string {

if len(c.TimeFormat) == 0 {
return time.RFC3339
}

switch c.TimeFormat {
case "Layout":
return time.Layout
case "ANSIC":
return time.ANSIC
case "UnixDate":
return time.UnixDate
case "RubyDate":
return time.RubyDate
case "RFC822":
return time.RFC822
case "RFC822Z":
return time.RFC822Z
case "RFC850":
return time.RFC850
case "RFC1123":
return time.RFC1123
case "RFC1123Z":
return time.RFC1123Z
case "RFC3339":
return time.RFC3339
case "RFC3339Nano":
return time.RFC3339Nano
case "Kitchen":
return time.Kitchen
case "Stamp":
return time.Stamp
case "StampMilli":
return time.StampMilli
case "StampMicro":
return time.StampMicro
case "StampNano":
return time.StampNano
default:
return c.TimeFormat
}
return utils.GetTimeFormat(c.TimeFormat, time.RFC3339)
}

0 comments on commit 7456023

Please sign in to comment.