Skip to content

Instantly share code, notes, and snippets.

@dbridges
Created May 13, 2019 17:38
Show Gist options
  • Save dbridges/688fb9c9284fa49394be94c2dfe42434 to your computer and use it in GitHub Desktop.
Save dbridges/688fb9c9284fa49394be94c2dfe42434 to your computer and use it in GitHub Desktop.
type atomTime time.Time
func (a *atomTime) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
var v string
d.DecodeElement(&v, &start)
parsed, err := time.Parse(time.RFC3339, v)
if err != nil {
return err
}
*a = atomTime(parsed)
return nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment