@salesflare/joi-date-string

2.1.0 • Public • Published

joi-date-string

Date string validation rule for Joi

Build Status Greenkeeper badge

What

Allows you to do Joi.dateString().

Uses moment for validation.

How

const myCustomJoi = Joi.extend(require('joi-date-string'));

myCustomJoi.dateString().validate('2018-10-05'); // pass

myCustomJoi.dateString().validate('05-10-2018'); // fail
myCustomJoi.dateString().validate(new Date()); // fail
myCustomJoi.dateString().validate('2018-08-02T12:09:04.378Z'); // fail
myCustomJoi.dateString().validate('1'); // fail
myCustomJoi.dateString().validate(1); // fail

Package Sidebar

Install

npm i @salesflare/joi-date-string

Weekly Downloads

14

Version

2.1.0

License

MIT

Unpacked Size

5.48 kB

Total Files

5

Last publish

Collaborators

  • anthony.salesflare
  • lievenjanssen
  • jaspervdk
  • adrivanhoudt
  • kdeclerck