Documentation ¶
Index ¶
- Constants
- Variables
- type AmericanDateTimeFormatter
- func (en *AmericanDateTimeFormatter) FullDate(t time.Time) string
- func (en *AmericanDateTimeFormatter) FullTime(t time.Time) string
- func (en *AmericanDateTimeFormatter) LongDate(t time.Time) string
- func (en *AmericanDateTimeFormatter) LongTime(t time.Time) string
- func (en *AmericanDateTimeFormatter) MediumDate(t time.Time) string
- func (en *AmericanDateTimeFormatter) MediumTime(t time.Time) string
- func (en *AmericanDateTimeFormatter) ShortDate(t time.Time) string
- func (en *AmericanDateTimeFormatter) ShortTime(t time.Time) string
- func (en *AmericanDateTimeFormatter) ShortTzTime(t time.Time) string
- type DateTimeExpr
- type DateTimeFormat
- type DateTimeFormatter
- type DateTimeSkeleton
- type Expression
- type Formatter
- type FormatterOption
- type GermanDateTimeFormatter
- func (de *GermanDateTimeFormatter) FullDate(t time.Time) string
- func (en *GermanDateTimeFormatter) FullTime(t time.Time) string
- func (de *GermanDateTimeFormatter) LongDate(t time.Time) string
- func (en *GermanDateTimeFormatter) LongTime(t time.Time) string
- func (de *GermanDateTimeFormatter) MediumDate(t time.Time) string
- func (en *GermanDateTimeFormatter) MediumTime(t time.Time) string
- func (de *GermanDateTimeFormatter) ShortDate(t time.Time) string
- func (en *GermanDateTimeFormatter) ShortTime(t time.Time) string
- func (en *GermanDateTimeFormatter) ShortTzTime(t time.Time) string
- type LiteralExpr
- type Node
- type NumberExpr
- type ParseTree
- type Parser
- type PluralExpr
- type SelectExpr
- type Symbol
- type VarExpr
Constants ¶
View Source
const ( EscapeChar = '\\' OpenChar = '{' CloseChar = '}' PartChar = ',' PoundChar = '#' ColonChar = ':' )
Variables ¶
View Source
var (
DefaultLocale = language.English
)
Functions ¶
This section is empty.
Types ¶
type AmericanDateTimeFormatter ¶
type AmericanDateTimeFormatter struct { Month map[time.Month]string Weekday map[time.Weekday]string }
func (*AmericanDateTimeFormatter) FullDate ¶
func (en *AmericanDateTimeFormatter) FullDate(t time.Time) string
func (*AmericanDateTimeFormatter) FullTime ¶
func (en *AmericanDateTimeFormatter) FullTime(t time.Time) string
3:04:05 PM MST - same as long format
func (*AmericanDateTimeFormatter) LongDate ¶
func (en *AmericanDateTimeFormatter) LongDate(t time.Time) string
Tuesday October 16, 1996
func (*AmericanDateTimeFormatter) LongTime ¶
func (en *AmericanDateTimeFormatter) LongTime(t time.Time) string
3:04:05 PM MST
func (*AmericanDateTimeFormatter) MediumDate ¶
func (en *AmericanDateTimeFormatter) MediumDate(t time.Time) string
October 16, 1996
func (*AmericanDateTimeFormatter) MediumTime ¶
func (en *AmericanDateTimeFormatter) MediumTime(t time.Time) string
3:04:05 PM
func (*AmericanDateTimeFormatter) ShortDate ¶
func (en *AmericanDateTimeFormatter) ShortDate(t time.Time) string
10/16/1996
func (*AmericanDateTimeFormatter) ShortTime ¶
func (en *AmericanDateTimeFormatter) ShortTime(t time.Time) string
3:04 PM
func (*AmericanDateTimeFormatter) ShortTzTime ¶
func (en *AmericanDateTimeFormatter) ShortTzTime(t time.Time) string
3:04 PM MST
type DateTimeExpr ¶
type DateTimeExpr struct { // Key is the key for the data map when this // expression is being formatted. Key string `json:"key"` // The type: date or time Type string `json:"type"` // Format represents the DateFormat enum value Format DateTimeFormat `json:"format"` }
type DateTimeFormat ¶
type DateTimeFormat = string
const ( Short DateTimeFormat = "short" ShortTz DateTimeFormat = "shorttz" Medium DateTimeFormat = "medium" Long DateTimeFormat = "long" Full DateTimeFormat = "full" )
type DateTimeFormatter ¶
type DateTimeFormatter interface { ShortDate(time.Time) string MediumDate(time.Time) string LongDate(time.Time) string FullDate(time.Time) string ShortTime(time.Time) string ShortTzTime(time.Time) string MediumTime(time.Time) string LongTime(time.Time) string FullTime(time.Time) string }
DateTimeFormatter is an interface for a type that formats a date/time in a variety of formats.
type DateTimeSkeleton ¶
type DateTimeSkeleton struct { }
DateTimeSkeleton is an ICU datetime skeleton.
type Expression ¶
type Expression interface{}
type Formatter ¶
type Formatter interface { Format(*ParseTree) (string, error) FormatMap(*ParseTree, map[string]any) (string, error) }
func NewFormatter ¶
func NewFormatter(opts ...FormatterOption) (Formatter, error)
NewFormatter creates a new formatter with the given options
type FormatterOption ¶
type FormatterOption func(f *formatter)
func WithLocale ¶
func WithLocale(locale language.Tag) FormatterOption
type GermanDateTimeFormatter ¶
func (*GermanDateTimeFormatter) FullDate ¶
func (de *GermanDateTimeFormatter) FullDate(t time.Time) string
func (*GermanDateTimeFormatter) FullTime ¶
func (en *GermanDateTimeFormatter) FullTime(t time.Time) string
3:04:05 PM MST - same as long format
func (*GermanDateTimeFormatter) LongDate ¶
func (de *GermanDateTimeFormatter) LongDate(t time.Time) string
func (*GermanDateTimeFormatter) LongTime ¶
func (en *GermanDateTimeFormatter) LongTime(t time.Time) string
3:04:05 PM MST
func (*GermanDateTimeFormatter) MediumDate ¶
func (de *GermanDateTimeFormatter) MediumDate(t time.Time) string
func (*GermanDateTimeFormatter) MediumTime ¶
func (en *GermanDateTimeFormatter) MediumTime(t time.Time) string
3:04:05 PM
func (*GermanDateTimeFormatter) ShortDate ¶
func (de *GermanDateTimeFormatter) ShortDate(t time.Time) string
func (*GermanDateTimeFormatter) ShortTime ¶
func (en *GermanDateTimeFormatter) ShortTime(t time.Time) string
3:04 PM
func (*GermanDateTimeFormatter) ShortTzTime ¶
func (en *GermanDateTimeFormatter) ShortTzTime(t time.Time) string
3:04 PM
type LiteralExpr ¶
type LiteralExpr struct {
Values []string
}
LiteralExpr represents a string literal
type Node ¶
type Node struct { Type string `json:"type"` Expr Expression `json:"expr"` }
type NumberExpr ¶
type NumberExpr struct {
Name string
}
type PluralExpr ¶
type PluralExpr struct { Select SelectExpr `json:"select"` Offset int `json:"offset"` }
type SelectExpr ¶
type Symbol ¶
type Symbol rune
Symbol represents a format symbol
const ( Era Symbol = 'G' Year Symbol = 'y' ShortMonth Symbol = 'M' LongMonth Symbol = 'L' DayOfMonth Symbol = 'd' DayOfWeek Symbol = 'E' AmPmMarker Symbol = 'a' Hour112 Symbol = 'h' Hour023 Symbol = 'H' Hour011 Symbol = 'K' Hour124 Symbol = 'k' Minute Symbol = 'm' Second Symbol = 's' TimeZone Symbol = 'Z' )
Click to show internal directories.
Click to hide internal directories.