changeset 3155:f09f142239a5

Unmarshal timestamps in ERDMS response Patch by Sascha L. Teichmann.
author Tom Gottfried <tom@intevation.de>
date Fri, 03 May 2019 18:39:49 +0200
parents b6c10b30d6bd
children cb3b31566e48
files pkg/soap/erdms/service.go
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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