jsUtils.isTime()

Checks if the variable is a valid time (hh:mi).

jsUtils.isTime( str )
  str - any javascript variable

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

The input variable is treated as a string representing time in the US time format (hh:mm am). This string is tested to be a real time and will return true if the time is valid. 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.isTime('10:00 am'));
            alert(jsUtils.isTime('25:30 pm'));
        }
    </script>
<body>
</body>
</html>

See Also