Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forecast datetime should be parsed #50

Open
AlmogBaku opened this issue May 15, 2016 · 1 comment
Open

Forecast datetime should be parsed #50

AlmogBaku opened this issue May 15, 2016 · 1 comment

Comments

@AlmogBaku
Copy link
Contributor

AlmogBaku commented May 15, 2016

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

@briandowns
Copy link
Owner

This is great since I've been meaning to do this however haven't had time. This should be done cross package. Can you make your solution take that into consideration for other calls thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants