Convert standard date string to Date, based on moment.js; and invalidate bad formatting.
MIT License
Convert standard date string to Date, based on moment.js; and invalidate bad formatting.
https://stackoverflow.com/questions/7445328/check-if-a-string-is-a-date-value
Valid date strings include (see /src/format.ts),
Invalid date string include,
import { toDate, toMoment } from "valid-moment";
console.log(toDate(DATE_STRING)) // Returns 'null' if invalid
console.log(toMoment(DATE_STRING)) // Returns 'null' if invalid
npm i valid-moment