@salesflare/joi-date-string

Date string validation rule for Joi

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
09Jun 7, 2021Aug 2, 2018Minified + gzip package size for @salesflare/joi-date-string in KB

Readme

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

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.