TypeScript Jak sprawdzić, czy ciąg jest datą
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