Skip to content

perry-mitchell/is-time

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

is-time

Check if a string is a time value

Build Status npm version

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