parthpatelreact-date-utils
v1.0.2
Published
A utility library for date manipulation in React applications, providing functions for formatting dates, calculating differences, and locale-specific date formatting
Downloads
211
Readme
React Date Utils
A utility library for date manipulation in React applications.
Features
- Format dates in various styles
- Calculate differences between dates
- Get the day of the week
- Locale-specific date formatting
Installation
You can install the package using npm:
npm install parthpatel-react-date-utils
## Usage
import { formatDate, calculateDifference } from 'parthpatel-react-date-utils';
const date1 = new Date('2022-01-01');
const date2 = new Date();
console.log(formatDate(date1, 'DD-MM-YYYY')); // Outputs: 01-01-2022
console.log(calculateDifference(date1, date2, 'days')); // Outputs: (number of days)