Author: | VitorLuizC |
---|---|
Views Total: | 797 views |
Official Page: | Go to website |
Last Update: | July 23, 2020 |
License: | MIT |
Preview:

Description:
format-date is a super tiny (~0.4kb) JavaScript library to format JavaScript date()
strings using custom Date and Time patterns:
- YY: 20
- YYYY: 2020
- M: 7
- MM: 07
- D: 1
- DD: 01
- H: 1
- HH: 01
- m: 1
- mm: 01
- s: 1
- ss: 01
- *: Escape
How to use it:
1. Install the format-date.
# Yarn $ yarn add @bitty/format-date # NPM $ npm i @bitty/format-date --save
2. Import the format-date as a module.
import formatDate from '@bitty/format-date';
3. Or from a CDN.
<script type="module"> import formatDate from 'https://cdn.jsdelivr.net/npm/@bitty/format-date@latest/dist/format-date.esm.js'; </script>
4. Format a date and determine the Date and Time patterns as follows:
formatDate(new Date(), 'YYYY-MM-DD-HH-mm-ss') => 2020-07-23-13-55-00