Skip to content

TypeScript code snippet – How to check if string is a date?

var isDate = function(date) {
    return (new Date(date) !== "Invalid Date") && !isNaN(new Date(date));
}
See also  Python code snippet - How to collect the index of a pandas dataframe into a list?

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.