1.0.6 • Published 2 years ago
date-fns-extensions v1.0.6
date-fns-extensions
Extensions for date-fns library with additional date manipulation utilities.
Installation
To install the library, run:
npm install date-fns-extensionsUsage
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-fnsluxonmomentdayjsholiday-jpworld-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.