gitlab.com/evatix-go/core@v1.3.55/dtformats/consts.go (about) 1 package dtformats 2 3 type Layout string 4 5 const ( 6 ANSIC Layout = "Mon Jan _2 15:04:05 2006" 7 UnixDate Layout = "Mon Jan _2 15:04:05 MST 2006" 8 RubyDate Layout = "Mon Jan 02 15:04:05 -0700 2006" 9 RFC822 Layout = "02 Jan 06 15:04 MST" 10 RFC822Z Layout = "02 Jan 06 15:04 -0700" // RFC822 with numeric zone 11 RFC850 Layout = "Monday, 02-Jan-06 15:04:05 MST" 12 RFC1123 Layout = "Mon, 02 Jan 2006 15:04:05 MST" 13 RFC1123Z Layout = "Mon, 02 Jan 2006 15:04:05 -0700" // RFC1123 with numeric zone 14 RFC3339 Layout = "2006-01-02T15:04:05Z07:00" 15 RFC3339Nano Layout = "2006-01-02T15:04:05.999999999Z07:00" 16 Kitchen Layout = "3:04PM" 17 Stamp Layout = "Jan _2 15:04:05" 18 StampMilli Layout = "Jan _2 15:04:05.000" 19 StampMicro Layout = "Jan _2 15:04:05.000000" 20 StampNano Layout = "Jan _2 15:04:05.000000000" 21 ) 22 23 func (layout Layout) Value() string { 24 return string(layout) 25 } 26 27 func (layout Layout) Is(format string) bool { 28 return string(layout) == format 29 } 30 31 func (layout Layout) IsTimeOnly() bool { 32 return layout == Kitchen 33 } 34 35 func (layout Layout) IsTimeFocused() bool { 36 return layout == Stamp || 37 layout == StampMilli || 38 layout == StampMicro || 39 layout == Kitchen || 40 layout == StampNano 41 } 42 43 func (layout Layout) IsDateTime() bool { 44 return layout == ANSIC || 45 layout == UnixDate || 46 layout == RubyDate || 47 layout == RFC822 || 48 layout == RFC822Z || 49 layout == RFC850 || 50 layout == RFC1123 || 51 layout == RFC1123Z || 52 layout == RFC3339 || 53 layout == RFC3339Nano 54 } 55 56 func (layout Layout) HasTimeZone() bool { 57 return layout == UnixDate || 58 layout == RubyDate || 59 layout == RFC822 || 60 layout == RFC822Z || 61 layout == RFC850 || 62 layout == RFC1123 || 63 layout == RFC1123Z || 64 layout == RFC3339 || 65 layout == RFC3339Nano 66 }