0.0.3 • Published 6 months ago

qol-date-functions v0.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
6 months ago

qol-date-functions

Uses a Date object to get a certain amount of time specified from the date, converts date to unix timestamp, and converts date into seconds, min, hours, etc.

Table of Contents

Installation

npm i qol-date-functions

Initialization

const timeFunctions = require('qol-date-functions');

Usage

Add time to Date object

timeFunctions.addSeconds(date, 10); // adds 10 seconds to the date object
timeFunctions.addMinutes(date, 10); // adds 10 minutes to the date object
timeFunctions.addHours(date, 10); // adds 10 hours to the date object
timeFunctions.addDays(date, 10); // adds 10 days to the date object
timeFunctions.addWeeks(date, 10); // adds 10 weeks to the date object
timeFunctions.addMonths(date, 10); // adds 10 months to the date object
timeFunctions.addYears(date, 10); // adds 10 years to the date object

Convert date object

timeFunctions.toUnix(date); // converts the date object to unix timestamp

timeFunctions.convertToSeconds(date); // converts the date object to seconds
timeFunctions.convertToMinutes(date); // converts the date object to minutes
timeFunctions.convertToHours(date); // converts the date object to hours
timeFunctions.convertToDays(date); // converts the date object to days
timeFunctions.convertToWeeks(date); // converts the date object to weeks

Planned Features

  • Subtract from date object instead of add to it

License

MIT

Author

J-dotJS

0.0.3

6 months ago

0.0.2

6 months ago

0.0.1

7 months ago