shape-date

0.2.2 • Public • Published

GitHub file size in bytes GitHub repo size GitHub tag (latest by date) GitHub Libraries.io dependency status for latest release npm

shape-date

shape a date from minimal input

this module is designed to give you back a Date even from a single day value, defaulting the rest to the current date.

example

const shapeDate = require('shape-date')

/*
  shapeDate([value, [separator='-']]) => Date

    [value] (Number)         :: just the day value
    [value] (String)         :: DD[-MM[-YYYY]]
    [separator='-'] (String) :: one of . / _ ,
*/

// imagine today is the 5th of November 2020:

shapeDate()             // 2020-11-05
shapeDate(3)            // 2020-11-03
shapeDate('4-7')        // 2020-07-04
shapeDate('7.01', '.')  // 2020-01-07
shapeDate('12-11-1990') // 1990-11-12

Package Sidebar

Install

npm i shape-date

Weekly Downloads

3

Version

0.2.2

License

MIT

Unpacked Size

5.84 kB

Total Files

5

Last publish

Collaborators

  • bernardini687