1
0
mirror of https://github.com/interviewstreet/go-jira.git synced 2025-03-17 20:47:57 +02:00

Add MarshalJSON method for Time type

This commit is contained in:
Jannis Andrija Schnitzer 2018-06-27 13:32:48 +02:00
parent d8ff51da51
commit b00c22d526

View File

@ -344,6 +344,12 @@ func (t *Time) UnmarshalJSON(b []byte) error {
return nil
}
// MarshalJSON will transform the time.Time into a JIRA time
// during the creation of a JIRA request
func (t Time) MarshalJSON() ([]byte, error) {
return []byte(time.Time(t).Format("\"2006-01-02T15:04:05.999-0700\"")), nil
}
// UnmarshalJSON will transform the JIRA date into a time.Time
// during the transformation of the JIRA JSON response
func (t *Date) UnmarshalJSON(b []byte) error {