# HG changeset patch # User Tom Gottfried # Date 1556901589 -7200 # Node ID f09f142239a5fdf9e576b301a7bfb2aa8c629dbe # Parent b6c10b30d6bdbce55c5f99824878657037096416 Unmarshal timestamps in ERDMS response Patch by Sascha L. Teichmann. diff -r b6c10b30d6bd -r f09f142239a5 pkg/soap/erdms/service.go --- a/pkg/soap/erdms/service.go Fri May 03 15:08:27 2019 +0200 +++ b/pkg/soap/erdms/service.go Fri May 03 18:39:49 2019 +0200 @@ -118,6 +118,21 @@ // lastupdate, last modification date time of this record type LastupdateType time.Time +const LastupdateTypeFormat = "2006-01-02T15:04:05.999Z07:00" + +func (lut *LastupdateType) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { + var value string + if err := d.DecodeElement(&value, &start); err != nil { + return err + } + t, err := time.Parse(LastupdateTypeFormat, value) + if err != nil { + return err + } + *lut = LastupdateType(t) + return nil +} + // one of the supported languages (basic and additional set), based on ISO 639-1 type LangType string