Something went wrong. Try again.
Something went wrong. Try again.
719 B · 23 lines
TypeScript
at main
123456789101112131415161718192021222324/*|--------------------------------------------------------------------------| Validator file|--------------------------------------------------------------------------|| The validator file is used for configuring global transforms for VineJS.| The transform below converts all VineJS date outputs from JavaScript| Date objects to Luxon DateTime instances, so that validated dates are| ready to use with Lucid models and other parts of the app that expect| Luxon DateTime.|*/
import { DateTime } from 'luxon'import { VineDate } from '@vinejs/vine'
declare module '@vinejs/vine/types' { interface VineGlobalTransforms { date: DateTime }}
VineDate.transform((value) => DateTime.fromJSDate(value))