Extensions for date-fns
library with additional date manipulation utilities.
To install the library, run:
npm install date-fns-extensions
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));
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'));
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'));
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.
Contributions are welcome! If you have a feature request, bug report, or pull request, please feel free to contribute.