isDate Function Documentation

The isDate function checks if the input string is a valid date.

Import

The function can be imported using ES6 syntax from the "multiform-validator" package:

import { isDate } from 'multiform-validator';

Alternatively, you can import the function using CommonJS syntax with require (Node.js):

const { isDate } = require('multiform-validator');

Parameters

The function takes one parameter:

Examples

// Example 1 - Valid date
const result1 = isDate("1999-12-31");
console.log(result1); // true

// Example 2 - Valid date
const result2 = isDate("2021-01-01");
console.log(result2); // true

// Example 3 - Invalid date
const result3 = isDate("1234 5678 9012 3456");
console.log(result3); // false

Notes

The function expects the input value to be passed as a string.