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 unzip files using zipfile module ?

Leave a Reply

Your email address will not be published. Required fields are marked *

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