Answers for "how to validate date in react"

0

how to validate date in react

const date = '2016-10-19';
const dateFormat = 'DD-MM-YYYY';
const toDateFormat = moment(new Date(date)).format(dateFormat);
moment(toDateFormat, dateFormat, true).isValid();

// Note: `new Date()` circumvents the warning that
// Moment throws (https://momentjs.com/guides/#/warnings/js-date/),
// but may not be optimal.
Posted by: Guest on June-07-2020
-1

how to validate date in react

// using momentJS
moment('Decimal128', 'YYYY-MM-DD').isValid() // true
Posted by: Guest on June-07-2020
0

how to validate date in react

const date = '2016-10-19';
const dateFormat = 'DD-MM-YYYY';
const toDateFormat = moment(new Date(date)).format(dateFormat);
moment(toDateFormat, dateFormat, true).isValid();

// Note: `new Date()` circumvents the warning that
// Moment throws (https://momentjs.com/guides/#/warnings/js-date/),
// but may not be optimal.
Posted by: Guest on June-07-2020
-1

how to validate date in react

// using momentJS
moment('Decimal128', 'YYYY-MM-DD').isValid() // true
Posted by: Guest on June-07-2020

Code answers related to "how to validate date in react"

Code answers related to "Javascript"

Browse Popular Code Answers by Language