Skip to content
This repository has been archived by the owner on Dec 3, 2024. It is now read-only.

Commit

Permalink
fix: date Type
Browse files Browse the repository at this point in the history
fix: date Type
  • Loading branch information
Marine-Berthier authored Feb 28, 2022
1 parent 95b5ce5 commit b3d6147
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/lib/__tests__/dateEncoding.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { decodeDate, encodeDate } from "../dateEncoding"
describe("dateEncoding", () => {
describe("#encodeDate", () => {
it("returs null without a year", () => {
expect(encodeDate({})).toBe(null)
expect(encodeDate({ year: null, month: null })).toBe(null)
})

it("defaults month to january if only year is provided", () => {
expect(encodeDate({ year: 1988 })).toEqual("1988-01-01")
expect(encodeDate({ year: 1988, month: null })).toEqual("1988-01-01")
})

it("converts date to YYYY-MM-DD format", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/dateEncoding.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Date as DateType } from "../types/models"

export const encodeDate = (date: DateType = {}) => {
export const encodeDate = (date: DateType) => {
if (!date) {
return null
}
Expand Down
4 changes: 2 additions & 2 deletions src/types/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ export interface SearchWhatsappLead extends SearchLeads {
}

export interface Date {
month?: number
year?: number
month: number
year: number
}

export interface PresignedUrl {
Expand Down

0 comments on commit b3d6147

Please sign in to comment.