Skip to content
Snippets Groups Projects
Verified Commit 46f25881 authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Fix time format for coach sequence API

parent eeec5901
Branches
Tags
No related merge requests found
......@@ -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
......
......@@ -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
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment