1
0
mirror of https://github.com/interviewstreet/go-jira.git synced 2025-03-25 21:28:55 +02:00

Add MarshalJSON method for Date (untested)

This commit is contained in:
Jannis Andrija Schnitzer 2018-01-19 17:57:08 +01:00
parent 1a2c703f7f
commit 3efb46493f

View File

@ -367,6 +367,14 @@ func (t *Date) UnmarshalJSON(b []byte) error {
return nil
}
// MarshalJSON will transform the Date object into a short
// date string as JIRA expects during the creation of a
// JIRA request
func (t Date) MarshalJSON() ([]byte, error) {
time := time.Time(t)
return []byte(time.Format("\"2006-01-02\"")), nil
}
// Worklog represents the work log of a JIRA issue.
// One Worklog contains zero or n WorklogRecords
// JIRA Wiki: https://confluence.atlassian.com/jira/logging-work-on-an-issue-185729605.html