Skip to content

Format date fields with Day.js

Format string date and time fields with Day.js by setting dateParser to 'dayjs'. The plugin emits dayjs(...).format(...) and adds the import for you, so the factories reuse the date library your project already ships.

kubb.config.ts
typescript
import { 
defineConfig
} from 'kubb/config'
import {
pluginTs
} from '@kubb/plugin-ts'
import {
pluginFaker
} from '@kubb/plugin-faker'
export default
defineConfig
({
input
: './petStore.yaml',
output
: {
path
: './src/gen',
clean
: true },
plugins
: [
pluginTs
(),
pluginFaker
({
dateParser
: 'dayjs',
}), ], })