TypeScript, как проверить, является ли строка датой
var isDate = function(date) {
return (new Date(date) !== "Invalid Date") && !isNaN(new Date(date));
}
Silver
var isDate = function(date) {
return (new Date(date) !== "Invalid Date") && !isNaN(new Date(date));
}
export const isDate = date => ((new Date(date) instanceof Date) && !isNaN(new Date(date)) && isNaN(date))
// here third check is added to check if user adds values like 1 , 2 etc