greatefue-datewizard
v1.0.4
Published
A Package which transform date to a friendly sentence etc.
Downloads
3
Readme
Table of Contents
Installation
$ yarn add greatefue-datewizard
$ npm i greatefue-datewizard
Usage
In your .ts or .js file,
- import the package
import { DaysAgo } from 'greatefue-datewizard';
- Call the function
var i = DaysAgo("2021-01-01");
console.log(i) //2 months ago
- Passing Optional Parameters
var i = DaysAgo("2021-01-01",{date:true});
console.log(i) //2 months ago
- Passing a future date returns difference from the current date to the future date.
var i = DaysAgo("2099-12-31");
console.log(i) //78 years into the future
Optional Parameter Table
|Parameter | Datatype | Description | Example | Example Output |
| ------------ |:------------:| :------------------------------------------------------- | :-------------------------------------------------------- | :------------------ |
| date | boolean | Extract year month day from date or datetime | DaysAgo("2021-01-01T00:00:00",{date:true});
| //2 months ago |
| time | boolean | Extract hour minute second from date or datetime | DaysAgo("2021-01-01T00:00:00",{time:true});
| //2 hours ago |
| year | boolean | Extract year from date or datetime | DaysAgo("2021-01-01T00:00:00",{year:true});
| //2 years ago |
| month | boolean | Extract month from date or datetime | DaysAgo("2021-01-01T00:00:00",{month:true});
| //2 months ago |
| day | boolean | Extract day from date or datetime | DaysAgo("2021-01-01T00:00:00",{day:true});
| //2 days ago |
| hour | boolean | Extract hour from datetime | DaysAgo("2021-01-01T00:00:00",{hour:true});
| //2 hours ago |
| minute | boolean | Extract minute from datetime | DaysAgo("2021-01-01T00:00:00",{minute:true});
| //2 minutes ago |
| second | boolean | Extract second from datetime | DaysAgo("2021-01-01T00:00:30",{second:true});
| //2 second ago |
Author
Great Efue
Please consider supporting me on Patreon. Become a Patron of Great Efue!
License
Team
These are folks that keep the project moving and are resources for help.
Technical Steering Committee (TSC)
The people who manage releases, review feature requests, and meet regularly to ensure GreatEfue-DateWizard is properly maintained.
Reviewers
The people who review and implement new features.
Committers
The people who review and fix bugs and help triage issues.