Skip to content

Commit

Permalink
refactor: Filter warning messages as string array in DatePickerField
Browse files Browse the repository at this point in the history
  • Loading branch information
4dr1en committed Sep 18, 2024
1 parent f36fea2 commit 8d63653
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default defineComponent({

this.warningMessages = this.warningRules
.map((rule) => rule(value))
.filter((result) => typeof result === 'string')
.filter((result) => typeof result === 'string') as string[]
},
},
})
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { notAfterTodayFn } from '@/rules/notAfterToday/index.ts'
import dayjs from 'dayjs'
import { defaultErrorMessages } from '@/rules/notAfterToday/locales'
import { it, describe, expect } from 'vitest'
import { formatDateToDDMMYYYYFn } from '../'

const DATE_FORMAT = 'DD/MM/YYYY'

Expand All @@ -28,9 +27,4 @@ describe('notAfterTodayFn', () => {
it('returns true when value is today', () => {
expect(notAfterToday(today)).toBe(true)
})

it('returns date in DD/MM/YYYY format', () => {
const date = new Date('2021-01-01')
expect(formatDateToDDMMYYYYFn(date)).toBe('01/01/2021')
})
})
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import dayjs from 'dayjs'

import { notBeforeToday, notBeforeTodayFn, formatDateToDDMMYYYY } from '../'
import { notBeforeToday, notBeforeTodayFn } from '../'
import { describe, it, expect } from 'vitest'

const DATE_FORMAT = 'DD/MM/YYYY'
Expand Down Expand Up @@ -33,9 +33,4 @@ describe('notBeforeToday', () => {
it('returns true when value is today', () => {
expect(notBeforeToday(today)).toBe(true)
})

it('returns date in DD/MM/YYYY format', () => {
const date = new Date('2021-01-01')
expect(formatDateToDDMMYYYY(date)).toBe('01/01/2021')
})
})

0 comments on commit 8d63653

Please sign in to comment.