regex-datetime
v1.1.2
Published
Regular expressions for dates and times
Downloads
36
Readme
regex-datetime
Regular expressions for dates and times that correctly account for leap years.
Installation
npm install regex-datetime
Usage
import { customDateTime, isoDate, isoDateTime, isoTime } from "regex-datetime";
isoDateTime().test("2004-01-16T19:23:25.197Z"); // true
isoDate().test("2004-01-16"); // true
isoTime().test("19:23:25.197Z"); // true
const customDateTimeRegExp = customDateTime(({ YYYY, MM, DD, hh, mm }) => {
return `${DD}/${MM}/${YYYY} @ ${hh}:${mm}`;
});
customDateTimeRegExp().test("16/01/2004 @ 19:23"); // true