date-fns-extensions

1.0.6 • Public • Published

date-fns-extensions

Extensions for date-fns library with additional date manipulation utilities.

Installation

To install the library, run:

npm install date-fns-extensions

Usage

Calculate Working Days

Calculates the number of working days between two dates, excluding weekends and public holidays in Japan.

import { calculateWorkingDays } from 'date-fns-extensions';
const start = new Date(2024, 0, 1); // January 1, 2024
const end = new Date(2024, 0, 31); // January 31, 2024
console.log(calculateWorkingDays(start, end));

Convert to Calendar

Converts a Gregorian date to a specified calendar system.

import { convertToCalendar } from 'date-fns-extensions';
const date = new Date(2024, 0, 1); // January 1, 2024
console.log(convertToCalendar(date, 'Japanese'));

Format With Libraries

Formats a date using multiple date libraries for comparison.

import { formatWithLibraries } from 'date-fns-extensions';
const date = new Date(2024, 0, 1); // January 1, 2024
console.log(formatWithLibraries(date, 'yyyy-MM-dd'));

Dependencies

This library relies on the following packages:

  • date-fns
  • luxon
  • moment
  • dayjs
  • holiday-jp
  • world-calendars

Ensure these are installed in your project to utilize date-fns-extensions fully.

Contributing

Contributions are welcome! If you have a feature request, bug report, or pull request, please feel free to contribute.

Package Sidebar

Install

npm i date-fns-extensions

Weekly Downloads

0

Version

1.0.6

License

MIT

Unpacked Size

3.64 kB

Total Files

3

Last publish

Collaborators

  • konstantynovivan