Skip to content

Commit

Permalink
Merge pull request #142 from vshn/fix-save-date
Browse files Browse the repository at this point in the history
Fix payslip saves
  • Loading branch information
ccremer authored Nov 18, 2022
2 parents d75c3a5 + a0a81b1 commit b8ff432
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/odoo/date.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package odoo
import (
"bytes"
"encoding/json"
"fmt"
"time"
)

Expand All @@ -28,7 +29,7 @@ func (d *Date) MarshalJSON() ([]byte, error) {
if d.IsZero() {
return []byte("false"), nil
}
return []byte(d.Format(DateTimeFormat)), nil
return []byte(fmt.Sprintf(`"%s"`, d.Format(DateTimeFormat))), nil
}

func (d *Date) UnmarshalJSON(b []byte) error {
Expand Down
2 changes: 1 addition & 1 deletion pkg/odoo/date_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func TestDate_MarshalJSON(t *testing.T) {
},
"GivenTime_ThenReturnFormatted": {
givenDate: Date{Time: time.Date(2021, 02, 03, 4, 5, 6, 0, time.UTC)},
expectedOutput: "2021-02-03 04:05:06",
expectedOutput: `"2021-02-03 04:05:06"`,
},
}
for name, tc := range tests {
Expand Down

0 comments on commit b8ff432

Please sign in to comment.