Closed
Description
Seems that Facebook has changed the timestamp formatting on at least some routes, such as /<post_id>
, to something resembling ISO8601. I have this code to parse it, I would submit a PR but not sure if its outside the scope of the project or if we should attempt to parse this new format in the existing code as part of decodeField
/decode
like we do for standard time.Time
already:
type FacebookISO8601 time.Time
func (it FacebookISO8601) MarshalJSON() ([]byte, error) {
return []byte(time.Time(it).Format(`"2006-01-02T15:04:05-0700"`)), nil
}
func (it *FacebookISO8601) UnmarshalJSON(data []byte) error {
t, err := time.ParseInLocation(`"2006-01-02T15:04:05-0700"`, string(data), time.UTC)
if err == nil {
*it = FacebookISO8601(t)
}
return err
}
Activity