UnmarshalJSON parses an RFC3339 date string into a time object borrowed from: https://stackoverflow.com/a/39180230/141023
(data []byte)
| 46 | // UnmarshalJSON parses an RFC3339 date string into a time object |
| 47 | // borrowed from: https://stackoverflow.com/a/39180230/141023 |
| 48 | func (t *Time) UnmarshalJSON(data []byte) (err error) { |
| 49 | str := string(data) |
| 50 | |
| 51 | // Get rid of the quotes "" around the value. |
| 52 | // A second option would be to include them in the date format string |
| 53 | // instead, like so below: |
| 54 | // time.Parse(`"`+time.RFC3339Nano+`"`, s) |
| 55 | str = str[1 : len(str)-1] |
| 56 | |
| 57 | timeObj, err := ParseTime(str) |
| 58 | t.Time = timeObj |
| 59 | return |
| 60 | } |
| 61 | |
| 62 | // ============================================================================= |
| 63 | // JSON Objects |
nothing calls this directly
no test coverage detected