20 lines
466 B
JavaScript
20 lines
466 B
JavaScript
//#region src/predicate/isDate.ts
|
|
/**
|
|
* Checks if `value` is a Date object.
|
|
*
|
|
* @param {unknown} value The value to check.
|
|
* @returns {value is Date} Returns `true` if `value` is a Date object, `false` otherwise.
|
|
*
|
|
* @example
|
|
* const value1 = new Date();
|
|
* const value2 = '2024-01-01';
|
|
*
|
|
* console.log(isDate(value1)); // true
|
|
* console.log(isDate(value2)); // false
|
|
*/
|
|
function isDate(value) {
|
|
return value instanceof Date;
|
|
}
|
|
//#endregion
|
|
exports.isDate = isDate;
|