regex-datetime
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published

npm verison npm bundle size npm downloads

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

Readme

Keywords

Package Sidebar

Install

npm i regex-datetime

Weekly Downloads

1

Version

1.1.2

License

MIT

Unpacked Size

18.8 kB

Total Files

15

Last publish

Collaborators

  • ijxy