Skip to content

Forecast datetime should be parsed #50

@AlmogBaku

Description

@AlmogBaku

JsonUnixTime helper for that matter:

type JsonUnixTime time.Time
func (t JsonUnixTime) MarshalJSON() ([]byte, error) {
    return strconv.AppendInt(nil, time.Time(t).Unix(), 10), nil
}
func (t *JsonUnixTime) UnmarshalJSON(data []byte) (err error) {
    // Fractional seconds are handled implicitly by Parse.
    unixTime, err := strconv.ParseInt(string(data), 10, 64)
    *t = JsonUnixTime(time.Unix(unixTime, 0))
    return nil
}

Will work on a PR later

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions