1.0.4 • Published 2 years ago
human-string-to-date-time v1.0.4
Human String To Date/Time
A library that parses a human representation of a UK English formatted date/time into an object.
It will always return the object with bits that are unkown are set to null.
Example Inputs
1st DecemberDecember 1stDecember 11 DecDec 1993Dec 199301/1201-1201.1201.12.9301.12.199301.12.19931pm1:12pm13:1213:12:1013:12:10.300quarter to 12Wednesday 16thThursdaySat12th November 1995 at quarter past 2
Usage
import { parse } from 'human-string-to-date-time';
console.log(parse('12th November 1995 at quarter past 2'));outputs
{
dayOfWeek: 0,
day: 11,
month: 10,
year: 1995,
hour: 2,
minute: 15,
second: null,
millisecond: null,
wasTwelveHourFormat: true
}Bugs
If you have a string that you believe should be parseable but is not working please open an issue.