Skip to content

Latest commit

 

History

History
77 lines (47 loc) · 1.16 KB

README.md

File metadata and controls

77 lines (47 loc) · 1.16 KB

@reverse/date

Useful functions for handling dates.

Install

npm install @reverse/date

Table of Contents


Usage

dateEqualsNow(month, date, year)

Checks if a given date is the same date as today.

Parameters

  • month: Number: The month in a number. Leading zero optional.
  • date: Number: The date.
  • year: Number: The full year.

Example

import { dateEqualsNow } from '@reverse/date';

// Assuming the today's date is 6/19/2019.

dateEqualsNow(06, 19, 2019);
// true

dateEqualsNow(04, 20, 2069);
// false

formatDate(date)

A nicely formatted date with time in AM and PM.

Parameters

  • date: Date: A date to format.

Example

import { formatDate } from '@reverse/date';

formatDate(new Date());
// Example Output: "2019-06-21 at 10:53am"

getEasterDate(year)

Finds the month and date of easter of that year.

Paramerters

  • year: Number: The email to check.

Example

import { getEasterDate } from '@reverse/date';

getEasterDate(2020);
// "04.12"