is-time
v0.1.0
Published
Check if a string is a time value
Downloads
9
Maintainers
Readme
is-time
Check if a string is a time value
About
is-time
provides a simple function which can be used to test if a value resembles a time.
Installation is easy:
npm install is-time --save
# or
yarn add is-time
Usage
Once imported, simply pass a string value to isTime
. Non-string values will throw exceptions.
const isTime = require("is-time");
isTime("23:43:12+0100"); // true
isTime("12:36:23.237 AM"); // true
isTime("03:71:02 a.m."); // false
isTime(""); // false
isTime({}); // error