1.0.0 • Published 2 years ago

back-in-time v1.0.0

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

Introduction

A versatile JavaScript library for simplified historical date. "back-in-time" provides an intuitive module that allows developers to effortlessly retrieve past dates from previous years and obtain them in an array with customizable formatting.

Key Features:

**- Date Generation:** Easily generate past dates by specifying the number of years ago.

**-Custom Formatting:** Format the output dates according to your application's requirements.

**-Date Array:** Retrieve dates in an array, enabling efficient batch processing.

**-Lightweight:** Keep your project dependencies minimal with a lightweight and efficient utility.

About Package ?

backInTime(currentDate, yearsToBack, dateFormat);

Installation

npm install back-in-time

Parameters

NameTypeDefaultDescription
currentDateString-currentDate paramete is required, this parameter will ensure that from which date you want to reverse to
yearsToBackString-yearsToBack paramete is required, this parameter will behave like end date where you want to stop
dateFormatStringYYYY-MM-DDdateFormat paramete is Optional, with the help of this parameter you can decide you date fromat when you get output

Usage

const { backInTime } = require("back-in-time");

const dates = backInTime("2024-01-01", "2022-01-01");
console.log(dates)

Expected Output

[
  '2022-01-01', '2022-02-01',
  '2022-03-01', '2022-04-01',
  '2022-05-01', '2022-06-01',
  '2022-07-01', '2022-08-01',
  '2022-09-01', '2022-10-01',
  '2022-11-01', '2022-12-01',
  '2023-01-01', '2023-02-01',
  '2023-03-01', '2023-04-01',
  '2023-05-01', '2023-06-01',
  '2023-07-01', '2023-08-01',
  '2023-09-01', '2023-10-01',
  '2023-11-01', '2023-12-01',
  '2024-01-01'
]

Supported Date Formats

Format CodeDate
MMMM Do YYYYJanuary 21st 2024
YYYY/MM/DD2024/01/21
D MMM, YYYY21 Jan, 2024
dddd, MMMM Do YYYYSunday, January 21st 2024
ddd, MMM D YYYYSun, Jan 21 2024
MMMM D, YYYYJanuary 21, 2024
ddd, MMMM D YYYYSun, January 21 2024
YYYY-MM-DD2024-01-21
1.0.0

2 years ago