MCPcopy Create free account
hub / github.com/git-bug/git-bug / UnmarshalJSON

Method UnmarshalJSON

bridge/jira/client.go:48–60  ·  view source on GitHub ↗

UnmarshalJSON parses an RFC3339 date string into a time object borrowed from: https://stackoverflow.com/a/39180230/141023

(data []byte)

Source from the content-addressed store, hash-verified

46// UnmarshalJSON parses an RFC3339 date string into a time object
47// borrowed from: https://stackoverflow.com/a/39180230/141023
48func (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

Callers

nothing calls this directly

Calls 1

ParseTimeFunction · 0.85

Tested by

no test coverage detected