Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lucasliet/date-util-ts
https://github.com/lucasliet/date-util-ts
Last synced: about 18 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/lucasliet/date-util-ts
- Owner: lucasliet
- License: mit
- Created: 2021-03-10T14:56:24.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-26T17:45:26.000Z (over 2 years ago)
- Last Synced: 2024-12-07T21:31:40.076Z (about 1 month ago)
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@lucasliet/date-util
- Size: 21.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Date Util
Date handler to parse string and date in ISO and BR format## installation
```SH
yarn add @lucasliet/date-util
```## usage
```TS
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
```JS
var DateUtil = require('@lucasliet/date-util');
var date = DateUtil.parseDate('2001-03-21');
```