diff --git a/client.go b/client.go index 6100db57c2e8cc7a17e028aafa85969213c751aa..0ba9b222bfaf5dbb437fd2ee199a1fa50ba0cff7 100644 --- a/client.go +++ b/client.go @@ -290,7 +290,7 @@ func (c *ApiClient) CoachSequence(line string, date time.Time) (CoachSequence, e func (c *ApiClient) loadCoachSequence(line string, date time.Time) (CoachSequence, error) { var err error - uri := fmt.Sprintf("%s/%s/%s", c.CoachSequenceBaseUrl, line, date.Format(TimeLayoutShort)) + uri := fmt.Sprintf("%s/%s/%s", c.CoachSequenceBaseUrl, line, date.Format(TimeLayoutMediumShort)) glog.Infof("Loading CoachSequence %s %s", line, date.Format(time.RFC3339)) var coachSequence CoachSequence diff --git a/types_util.go b/types_util.go index ba55d6203a775894aa6584735e2b7ead436a24d0..f45ebfb9c0d93c541addf5f3ce2270f35f518f7f 100644 --- a/types_util.go +++ b/types_util.go @@ -105,6 +105,42 @@ func (t *timeShort) Value() *time.Time { } } +type timeMediumShort struct { + time.Time +} + +const TimeLayoutMediumShort = "200601021504" + +func (t *timeMediumShort) MarshalXMLAttr(name xml.Name) (xml.Attr, error) { + if t == nil || t.IsZero() { + return xml.Attr{}, nil + } else { + return xml.Attr{ + Name: name, + Value: t.Format(TimeLayoutMediumShort), + }, nil + } +} + +func (t *timeMediumShort) UnmarshalXMLAttr(attr xml.Attr) error { + if attr.Value != "" { + value, err := time.Parse(TimeLayoutMediumShort, attr.Value) + if err != nil { + return err + } + t.Time = value + } + return nil +} + +func (t *timeMediumShort) Value() *time.Time { + if t != nil { + return &t.Time + } else { + return nil + } +} + type timeMedium struct { time.Time }