1
0
mirror of https://github.com/interviewstreet/go-jira.git synced 2025-01-07 23:01:48 +02:00

Merge pull request #100 from omira-sch/issue-time-fields

Change type to Time for issue time fields
This commit is contained in:
Andy Grunwald 2018-01-11 21:47:13 +01:00 committed by GitHub
commit c45f58a9ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -101,12 +101,12 @@ type IssueFields struct {
Project Project `json:"project,omitempty" structs:"project,omitempty"`
Resolution *Resolution `json:"resolution,omitempty" structs:"resolution,omitempty"`
Priority *Priority `json:"priority,omitempty" structs:"priority,omitempty"`
Resolutiondate string `json:"resolutiondate,omitempty" structs:"resolutiondate,omitempty"`
Created string `json:"created,omitempty" structs:"created,omitempty"`
Duedate string `json:"duedate,omitempty" structs:"duedate,omitempty"`
Resolutiondate Time `json:"resolutiondate,omitempty" structs:"resolutiondate,omitempty"`
Created Time `json:"created,omitempty" structs:"created,omitempty"`
Duedate Time `json:"duedate,omitempty" structs:"duedate,omitempty"`
Watches *Watches `json:"watches,omitempty" structs:"watches,omitempty"`
Assignee *User `json:"assignee,omitempty" structs:"assignee,omitempty"`
Updated string `json:"updated,omitempty" structs:"updated,omitempty"`
Updated Time `json:"updated,omitempty" structs:"updated,omitempty"`
Description string `json:"description,omitempty" structs:"description,omitempty"`
Summary string `json:"summary" structs:"summary"`
Creator *User `json:"Creator,omitempty" structs:"Creator,omitempty"`
@ -330,6 +330,10 @@ type Option struct {
// UnmarshalJSON will transform the JIRA time into a time.Time
// during the transformation of the JIRA JSON response
func (t *Time) UnmarshalJSON(b []byte) error {
// Ignore null, like in the main JSON package.
if string(b) == "null" {
return nil
}
ti, err := time.Parse("\"2006-01-02T15:04:05.999-0700\"", string(b))
if err != nil {
return err