package local import ( "gopkg.in/yaml.v3" "time" ) type PageTime struct { time.Time } // TimeFormat is the format string used when unmarshaling the time // from the yaml information. var TimeFormat = "01.02.2006 15:04:05 MST" func (pt *PageTime) UnmarshalYAML(n *yaml.Node) error { t, err := time.Parse(TimeFormat, n.Value) if err != nil { return err } pt.Time = t return nil }