@@ -79,15 +79,9 @@ isAfter("your-value", "2023-01-01");
7979:::
8080
8181::: tip
82- robust-validator library uses the [ dayjs ] ( https://day.js. org/ ) for the date validations.
82+ robust-validator library uses the [ date-fns ] ( https://date-fns. org ) for the date validations.
8383
84- You can check the possible date formats [ here] ( https://day.js.org/docs/en/parse/string-format ) .
85- :::
86-
87- ::: warning
88- You MUST install the [ dayjs] ( https://day.js.org/ ) is to your project.
89-
90- ` npm install dayjs ` or ` yarn add dayjs `
84+ You can check the possible date formats [ here] ( https://date-fns.org/v4.1.0/docs/format ) .
9185:::
9286
9387| Rule | Value | ` startAt ` | Is valid? |
@@ -128,15 +122,9 @@ isAfterOrEqual("your-value", "2023-01-01");
128122:::
129123
130124::: tip
131- robust-validator library uses the [ dayjs] ( https://day.js.org/ ) for the date validations.
132-
133- You can check the possible date formats [ here] ( https://day.js.org/docs/en/parse/string-format ) .
134- :::
135-
136- ::: warning
137- You MUST install the [ dayjs] ( https://day.js.org/ ) is to your project.
125+ robust-validator library uses the [ date-fns] ( https://date-fns.org ) for the date validations.
138126
139- ` npm install dayjs ` or ` yarn add dayjs `
127+ You can check the possible date formats [ here ] ( https://date-fns.org/v4.1.0/docs/format ) .
140128:::
141129
142130| Rule | Value | ` startAt ` | Is valid? |
@@ -329,15 +317,9 @@ isBefore("your-value", "2023-01-01");
329317:::
330318
331319::: tip
332- robust-validator library uses the [ dayjs] ( https://day.js.org/ ) for the date validations.
333-
334- You can check the possible date formats [ here] ( https://day.js.org/docs/en/parse/string-format ) .
335- :::
320+ robust-validator library uses the [ date-fns] ( https://date-fns.org ) for the date validations.
336321
337- ::: warning
338- You MUST install the [ dayjs] ( https://day.js.org/ ) is to your project.
339-
340- ` npm install dayjs ` or ` yarn add dayjs `
322+ You can check the possible date formats [ here] ( https://date-fns.org/v4.1.0/docs/format ) .
341323:::
342324
343325| Rule | Value | ` finishAt ` | Is valid? |
@@ -378,15 +360,9 @@ isBeforeOrEqual("your-value", "2023-01-01");
378360The field under validation must be before or equal to the given date.
379361
380362::: tip
381- robust-validator library uses the [ dayjs] ( https://day.js.org/ ) for the date validations.
382-
383- You can check the possible date formats [ here] ( https://day.js.org/docs/en/parse/string-format ) .
384- :::
385-
386- ::: warning
387- You MUST install the [ dayjs] ( https://day.js.org/ ) is to your project.
363+ robust-validator library uses the [ date-fns] ( https://date-fns.org ) for the date validations.
388364
389- ` npm install dayjs ` or ` yarn add dayjs `
365+ You can check the possible date formats [ here ] ( https://date-fns.org/v4.1.0/docs/format ) .
390366:::
391367
392368| Rule | Value | ` finishAt ` | Is valid? |
@@ -516,39 +492,45 @@ isConfirmed("your-data");
516492
517493The field under validation must be a valid date format which is acceptable by Javascript's Date object.
518494
495+ ::: tip
496+ robust-validator library uses the [ date-fns] ( https://date-fns.org ) for the date validations.
497+
498+ You can check the possible date formats [ here] ( https://date-fns.org/v4.1.0/docs/format ) .
499+ :::
500+
519501::: code-group
520502
521503``` ts [Declarative]
522504import { validate } from " robust-validator" ;
523505// ...
524- await validate (data , { startAt: " date:YYYY -MM-DD " });
506+ await validate (data , { startAt: " date:yyyy -MM-dd " });
525507```
526508
527509``` ts [Function-based]
528510import { validate , date } from " robust-validator" ;
529511// ...
530- await validate (data , { startAt: [date (" YYYY -MM-DD " )] });
512+ await validate (data , { startAt: [date (" yyyy -MM-dd " )] });
531513```
532514
533515``` ts [Direct usage]
534516import { isDate } from " robust-validator" ;
535517// ...
536- isDate (" your-data" , " YYYY -MM-DD " );
518+ isDate (" your-data" , " yyyy -MM-dd " );
537519```
538520
539521:::
540522
541523| Rule | Value | Is valid? |
542524| ----------------- | ---------------------------- | --------- |
543- | ` date:YYYY -MM-DD ` | ` null ` | 🔴 |
544- | ` date:YYYY -MM-DD ` | ` undefined ` | 🔴 |
545- | ` date:YYYY -MM-DD ` | ` 2023-12-16 ` | 🟢 |
546- | ` date:YYYY -MM-DD ` | ` 2023-01-01 ` | 🟢 |
547- | ` date:YYYY -MM-DD ` | ` December 16, 2023 12:00:00 ` | 🔴 |
548- | ` date:YYYY -MM-DD ` | ` 2022-13-01 ` | 🔴 |
549- | ` date:YYYY -MM-DD ` | ` 2022-12-32 ` | 🔴 |
550- | ` date:YYYY -MM-DD ` | ` 2022-02-29 ` | 🔴 |
551- | ` date:YYYY -MM-DD ` | ` false ` | 🔴 |
525+ | ` date:yyyy -MM-dd ` | ` null ` | 🔴 |
526+ | ` date:yyyy -MM-dd ` | ` undefined ` | 🔴 |
527+ | ` date:yyyy -MM-dd ` | ` 2023-12-16 ` | 🟢 |
528+ | ` date:yyyy -MM-dd ` | ` 2023-01-01 ` | 🟢 |
529+ | ` date:yyyy -MM-dd ` | ` December 16, 2023 12:00:00 ` | 🔴 |
530+ | ` date:yyyy -MM-dd ` | ` 2022-13-01 ` | 🔴 |
531+ | ` date:yyyy -MM-dd ` | ` 2022-12-32 ` | 🔴 |
532+ | ` date:yyyy -MM-dd ` | ` 2022-02-29 ` | 🔴 |
533+ | ` date:yyyy -MM-dd ` | ` false ` | 🔴 |
552534
553535## ` digits:value `
554536
0 commit comments