You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+37Lines changed: 37 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -80,6 +80,11 @@ Checks:
80
80
- maybeDate
81
81
- asDate
82
82
- maybeAsDate
83
+
- DateTime
84
+
- isDateTime
85
+
- maybeDateTime
86
+
- asDateTime
87
+
- maybeAsDateTime
83
88
- Enum
84
89
- isEnum
85
90
- maybeEnum
@@ -242,6 +247,31 @@ Options:
242
247
-`validator?: (value: T, options?: any, path?: Path[]) => boolean | Issue[]` - custom validation function; if false or Issue[] is returned it's an error
243
248
-`validatorOptions?: any` - options to pass to the _validator_
> NOTE: Requires peer dependencies `luxon` and `@types/luxon`.
255
+
256
+
Usage:
257
+
258
+
```typescript
259
+
isDateTime(options);
260
+
maybeDateTime(options);
261
+
asDateTime(options);
262
+
maybeAsDateTime(options);
263
+
```
264
+
265
+
Options:
266
+
267
+
-`converter?: (value: unknown, options?: any) => T | undefined` - custom converter function, if not defined or `undefined` is returned then built in conversions will be run
268
+
-`convertOptions` - options to pass to the _converter_
269
+
-`format` - custom date format used in conversion from `string` to `Date` see [Luxon formatting](https://moment.github.io/luxon/docs/manual/formatting)
270
+
-`maxFuture?: Duration` - if the value is after this duration into the future, it's an error `max-future`
271
+
-`maxPast?: Duration` - if the value is before this duration into the past, it's an error `max-past`
272
+
-`validator?: (value: T, options?: any, path?: Path[]) => boolean | Issue[]` - custom validation function; if false or Issue[] is returned it's an error
273
+
-`validatorOptions?: any` - options to pass to the _validator_
0 commit comments