https://github.com/bernardini687/shape-date
shape a date from minimal input
https://github.com/bernardini687/shape-date
argv date javascript minimal shape
Last synced: 3 months ago
JSON representation
shape a date from minimal input
- Host: GitHub
- URL: https://github.com/bernardini687/shape-date
- Owner: bernardini687
- License: mit
- Created: 2020-03-21T10:47:11.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-07-18T21:22:12.000Z (almost 2 years ago)
- Last Synced: 2024-10-16T10:31:51.474Z (7 months ago)
- Topics: argv, date, javascript, minimal, shape
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/shape-date
- Size: 479 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README





# 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
```js
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
```