https://github.com/bernardini687/minidate
🦕 deno utility module for simple date creation
https://github.com/bernardini687/minidate
deno minimal module
Last synced: 2 months ago
JSON representation
🦕 deno utility module for simple date creation
- Host: GitHub
- URL: https://github.com/bernardini687/minidate
- Owner: bernardini687
- License: mit
- Created: 2020-05-17T09:54:08.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-05-28T05:43:53.000Z (almost 5 years ago)
- Last Synced: 2025-02-23T15:06:25.810Z (3 months ago)
- Topics: deno, minimal, module
- Language: TypeScript
- Homepage: https://deno.land/x/minidate
- Size: 4.88 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# minidate
_shape a date from minimal input_
simple helper to get a Date out of a day value, defaulting the rest to the current date.
# usage
```
miniDate(value) => Datevalue (Number | String) : just the day value
value (String) : DD[-MM[-YYYY]]
``````ts
import miniDate from 'https://deno.land/x/[email protected]/mod.ts'// imagine today is the 5th of November 2020
miniDate() // output : 2020-11-05[...]
miniDate(3) // output : 2020-11-03[...]
miniDate('4-7') // output : 2020-07-04[...]
miniDate('07-01') // output : 2020-01-07[...]
miniDate('12-11-1990') // output : 1990-11-12[...]
miniDate(32) // output : Invalid Date
```# misc
this is also available on npm as [shape-date](https://www.npmjs.com/package/shape-date).