date-fns-plus
v1.0.1
Published
Enhances date-fns with additional date manipulation utilities.
Downloads
3
Maintainers
Readme
date-fns-plus
Enhances date-fns with additional date manipulation utilities, integrating seamlessly with luxon, moment-timezone, ms, and dayjs for a comprehensive date management solution.
Installation
npm install date-fns-plus
Usage
Here's how you can use the extended functionalities:
const { toRelativeTimeString, formatFromISOString, convertToTimezoneAndFormat, humanizeDuration, addDaysUsingDayjs } = require('date-fns-plus');
// Convert to relative time string
console.log(toRelativeTimeString(new Date()));
// Parse and format an ISO string
console.log(formatFromISOString('2020-10-01T14:48:00.000Z'));
// Convert to a specific timezone and format
console.log(convertToTimezoneAndFormat(new Date(), 'America/New_York'));
// Humanize duration from milliseconds
console.log(humanizeDuration(60000)); // 1 minute
// Add days to a date using Day.js
console.log(addDaysUsingDayjs(new Date(), 5));
Contributing
Contributions are welcome! Please feel free to submit a pull request.
License
MIT