jsUtils.isDate()

Checks if the variable is a valid date (mm/dd/yyyy).

jsUtils.isDate( str )
  str - any javascript variable

Returns true if the variable is a valid date or false otherwise.

The input variable is treated as a string representing date in the US date format (mm/dd/yyyy). This string is tested to be a real calendar date and will return true is the date is valid. The function correctly interprets leap years. More date formats will be added.

Example

<!DOCTYPE html>
<html>
<head>
    <script src="system/libs/jsUtils.js" type="text/javascript"></script>
    <script type="text/javascript">
        window.onload = function() {
            alert(jsUtils.isDate('5/11/2011'));
            alert(jsUtils.isDate('2/30/2011'));
        }
    </script>
<body>
</body>
</html>

See Also