A small, no-dependency package for normalizing time (hours, minutes, second) inputs from users.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test
.gitignore
.travis.yml
LICENSE
README.md
index.js
package.json

README.md

fuzzyTimeInput

Build Status

Normalize inconsistent time strings ("3pm","3:00p","15:00","3PM") to a consistant format. This small, no-dependency package supports a large variety of time entry formats (see the Unit Tests) and outputs military time (default) or JSON.

var fuzzytimeinput = require("fuzzytimeinput")
// It defaults to military time
fuzzytimeinput('3:30pm'); // '15:30'
fuzzytimeinput('3:30'); // '3:30'
fuzzytimeinput('15:00'); // '15:00'
fuzzytimeinput('4.4'); // '4:24'
// But you may prefer JSON if you wish to access the hours and minutes separately.
fuzzytimeinput('4.4','json'); // {hours:4,minutes:24}