1.0.3 • Published 5 years ago

yadate-converter v1.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

Build Status Coverage Status install size

yadate-converter

Yet another date to string and string to date converter

Main features

  • parse formatted string to date
  • format date to string

Install

Install it with NPM

npm install yadate-converter --save

Parse

    const date = parseDate('14.05.2018', 'DD.MM.YYYY');

Format

    const str = formatDate(new Date(), 'YYYY-M-D');

Tokens

TokenDescriptionExample
Y2 or 4 digit year2018 or 18
YYYY4 digit year2018
YY2 digit year18
Mmonth9
MM2 digit month09
Dday3
DD2 digit day03
Hhour4
HH2 digit hour04
mminutes8
mm2 digit minutes08
sseconds7
ss2 digit seconds07
Smiliseconds1 or 01 or 001
SS2 digit miliseconds02
SSS3 digit miliseconds003

License

MIT