@lucasliet/date-util
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

Date Util

Date handler to parse string and date in ISO and BR format

installation

yarn add @lucasliet/date-util

usage

import * as DateUtil from '@lucasliet/date-util';

const dateBR: string = DateUtil.toBRFormat(new Date());       //returns string in dd/MM/yyyy format

const dateISO: string = DateUtil.toISOFormat(dateBR);         //returns string in yyyy-MM-yyyy format

const isInBRFormat: boolean = DateUtil.isInBRFormat(dateBR);  //check if string pattern matches dd/MM/yyyy format

const date: Date = DateUtil.parseDate(dateBR);                //returns a date Object from dd/MM/yyyy or yyyy-MM-dd string format

for JavaScript <= es5 use require

var DateUtil = require('@lucasliet/date-util');
var date = DateUtil.parseDate('2001-03-21');

Readme

Keywords

Package Sidebar

Install

npm i @lucasliet/date-util

Weekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

9.35 kB

Total Files

8

Last publish

Collaborators

  • lucasliet