1.1.3 • Published 3 years ago

@umuralpay/js-dates v1.1.3

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

JS-Dates

Simple, lightweight javascript library for manipulating dates

Build Status

Dates is a simple, lightweight & typed date manipulator

Features

  • Getting UTC date
  • Ability to add "x" amount of hours, minutes and seconds to dates
  • Comparing dates
  • Formatting dates (TODO)
  • Locale support (TODO)

Installation

npm install @umuralpay/js-dates

or

yarn add @umuralpay/js-dates

Usage

Getting UTC Date

import {getUTCDate} from "@umuralpay/js-dates"; 
const date = getUTCDate(); // if epoch needed getUTCDate(true);

Adding Hours To Date

import {addHours} from "@umuralpay/js-dates"; 
const date = addHours(1); // hours: number, date = new Date(), utc = false, epoch = false

Adding Minutes To Date

import {addMinutes} from "@umuralpay/js-dates"; 
const date = addMinutes(30); // mins: number, date = new Date(), utc = false, epoch = false

Adding Seconds To Date

import {addSeconds} from "@umuralpay/js-dates"; 
const date = addSeconds(20); // secs: number, date = new Date(), utc = false, epoch = false

Note: if epoch is true utc parameter is ignored

Comparing Dates

import {isLater} from "@umuralpay/js-dates";

const date1 = new Date();
const date2 = new Date();
date2.setMinutes(date2.getMinutes() + 30);

console.log(isLater(date1, date2)); // returns false

## License

ISC
1.1.4

3 years ago

1.1.1

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago