fix date type for ISODate
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import type { Taskable } from '@/modules/task/interfaces/taskable'
|
import type { Taskable } from '@/modules/task/interfaces/taskable'
|
||||||
import { createStepFixture } from '@/modules/task/models/step.fixture'
|
import { createStepFixture } from '@/modules/task/models/step.fixture'
|
||||||
import { Task } from '@/modules/task/models/task'
|
import { Task } from '@/modules/task/models/task'
|
||||||
|
import { toISODate } from '@/shared/types/date'
|
||||||
import { faker } from '@faker-js/faker'
|
import { faker } from '@faker-js/faker'
|
||||||
import { describe, expect, it } from 'vitest'
|
import { describe, expect, it } from 'vitest'
|
||||||
|
|
||||||
@@ -16,7 +17,7 @@ describe('Task', () => {
|
|||||||
it('allows a new task from a taskable object', () => {
|
it('allows a new task from a taskable object', () => {
|
||||||
const taskable: Taskable = {
|
const taskable: Taskable = {
|
||||||
id: faker.datatype.uuid(),
|
id: faker.datatype.uuid(),
|
||||||
date: faker.date.recent(),
|
date: toISODate(faker.date.recent()),
|
||||||
title: faker.animal.lion(),
|
title: faker.animal.lion(),
|
||||||
link: faker.internet.url(),
|
link: faker.internet.url(),
|
||||||
steps: [createStepFixture()]
|
steps: [createStepFixture()]
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
export type ISODate = string
|
type Brand<K, T> = K & { __brand: T }
|
||||||
|
|
||||||
export const toISODate = (date: Date): ISODate => date.toISOString()
|
export type ISODate = Brand<string, 'ISODate'>
|
||||||
|
|
||||||
|
export const toISODate = (date: Date): ISODate => date.toISOString() as ISODate
|
||||||
|
|||||||
Reference in New Issue
Block a user