0.1.1 • Published 6 years ago

tiny-date-format v0.1.1

Weekly downloads
34
License
MIT
Repository
github
Last release
6 years ago

tiny-date-format

Build Status

tiny-date-format is a small library (around 400 B when gziped & minified) to format JavaScript Date object using same tokens as moment.

Install

tiny-date-format is published under NPM registry.

npm install --save tiny-date-format

# Use the command below if you're using Yarn.
yarn add tiny-date-format

Usage

tiny-date-format exports a function to format JavaScript Date object using moment tokens.

import format from 'tiny-date-format';

format(new Date(), 'DD/MM/YYYY HH [hours] and mm [minutes].');
// I'm escaping "hours" and "minutes" using same syntax as moment.

Supported tokens

Right now this lib supports the tokens below.

TokenTypeRange
DDDay01 to 31
DDay1 to 31
MMMonth01 to 12
MMonth1 to 12
YYYYYear0000 to 9999
YYYear0 to 99
HHHour00 to 23
HHour0 to 23
mmMinute00 to 59
mMinute0 to 59
ssSecond00 to 59
sSecond0 to 59
*Escape 

License

Released under MIT license. You can see it here.