1.0.4 • Published 3 years ago

greatefue-datewizard v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Table of Contents

  1. Installation
  2. Usage
  3. Optional Parameter Table
  4. Releases
  5. Author
  6. License
  7. Team

Installation

$ yarn add greatefue-datewizard
$ npm i greatefue-datewizard

Usage

In your .ts or .js file,

  1. import the package
import { DaysAgo } from 'greatefue-datewizard';
  1. Call the function
var i = DaysAgo("2021-01-01");
console.log(i) //2 months ago
  1. Passing Optional Parameters
var i = DaysAgo("2021-01-01",{date:true});
console.log(i) //2 months ago
  1. 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

ParameterDatatypeDescriptionExampleExample Output
datebooleanExtract year month day from date or datetimeDaysAgo("2021-01-01T00:00:00",{date:true});//2 months ago
timebooleanExtract hour minute second from date or datetimeDaysAgo("2021-01-01T00:00:00",{time:true});//2 hours ago
yearbooleanExtract year from date or datetimeDaysAgo("2021-01-01T00:00:00",{year:true});//2 years ago
monthbooleanExtract month from date or datetimeDaysAgo("2021-01-01T00:00:00",{month:true});//2 months ago
daybooleanExtract day from date or datetimeDaysAgo("2021-01-01T00:00:00",{day:true});//2 days ago
hourbooleanExtract hour from datetimeDaysAgo("2021-01-01T00:00:00",{hour:true});//2 hours ago
minutebooleanExtract minute from datetimeDaysAgo("2021-01-01T00:00:00",{minute:true});//2 minutes ago
secondbooleanExtract second from datetimeDaysAgo("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

FOSSA Status

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.