due-date-genius
v1.0.2
Published
A utility to generate final dates based on a due day of the month.
Downloads
4
Maintainers
Readme
due-date-genius
A utility to generate final dates based on a due day of the month.
Installation
You can install the due-date-genius
package via npm:
npm install due-date-genius
Usage
Importing the package
const generateFinalDay = require("due-date-genius");
Generating final dates
// Generate final date for due day 15
const finalDate = generateFinalDay(15);
console.log(finalDate); // Output: "2024-05-15"
Customizing current date
You can provide a custom current date as the second parameter:
const currentDate = new Date("2024-06-01");
const finalDate = generateFinalDay(10, currentDate);
console.log(finalDate); // Output: "2024-06-10"
API Documentation
generateFinalDay(dueDay, currentDate)
Generates a final date string based on the given due day and current date.
dueDay
(number): The day of the month for which the final date is generated.currentDate
(Date, optional): The current date. Defaults to the current system date.
Returns the final date string in the format "YYYY-MM-DD".
License
This project is licensed under the MIT License - see the LICENSE file for details.