Skip to content

Commit

Permalink
Fixed syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Fank committed Jul 1, 2024
1 parent 2496b27 commit 223267a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pkg/infra/models/jira_time.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ const (
// DateScheme is a custom time type for Jira dates.
type DateScheme time.Time

func (d DateScheme) MarshalJSON() ([]byte, error) {
return []byte(time.Time(d).Format(DateFormat)), nil
func (d *DateScheme) MarshalJSON() ([]byte, error) {
return []byte(time.Time(*d).Format(DateFormat)), nil
}

func (d DateScheme) UnmarshalJSON(data []byte) error {
func (d *DateScheme) UnmarshalJSON(data []byte) error {
if string(data) == "null" {
return nil
}
Expand All @@ -24,18 +24,18 @@ func (d DateScheme) UnmarshalJSON(data []byte) error {
return err
}

d = DateScheme(parsed)
*d = DateScheme(parsed)
return nil
}

// DateTimeScheme is a custom time type for Jira times.
type DateTimeScheme time.Time

func (d DateTimeScheme) MarshalJSON() ([]byte, error) {
return []byte(time.Time(d).Format(TimeFormat)), nil
func (d *DateTimeScheme) MarshalJSON() ([]byte, error) {
return []byte(time.Time(*d).Format(TimeFormat)), nil
}

func (d DateTimeScheme) UnmarshalJSON(data []byte) error {
func (d *DateTimeScheme) UnmarshalJSON(data []byte) error {
if string(data) == "null" {
return nil
}
Expand All @@ -45,6 +45,6 @@ func (d DateTimeScheme) UnmarshalJSON(data []byte) error {
return err
}

d = DateTimeScheme(parsed)
*d = DateTimeScheme(parsed)
return nil
}

0 comments on commit 223267a

Please sign in to comment.