node-ejs-renderer/node_modules/validator/es/lib/toDate.js
2024-06-09 13:55:01 -04:00

6 lines
184 B
JavaScript

import assertString from './util/assertString';
export default function toDate(date) {
assertString(date);
date = Date.parse(date);
return !isNaN(date) ? new Date(date) : null;
}