Skip to content

oscareduardolp6/semimonthly-paydays-ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Semimonthly Paydays

Creating an application that would help me know how much money I had to save each time I got paid at work, I came across the fact that there was no library that provided me with the functionality to determine the paydays and how many of those would be between two dates. Taking this into account and believing that perhaps someone else could find it useful, I developed this library.

Installation

Install my-project with npm

  npm i semimonthly-paydays-ts

Usage/Examples

There are 2 exported functions:

getSemimonthlyDaysBetweenTwoDates

Example 1

    const firstDate = new Date(2023, 3, 29); 
    const secondDate = new Date(2023, 3, 30);
    const daysBetweenTwoDates = getSemimonthlyDaysBetweenTwoDates(firstDate, secondDate);
    console.log(daysBetweenTwoDates) // 0 
    // Because the pay day in that month is 31 

Example 2

    const firstDate = new Date(2023, 2, 30);
    const secondDate = new Date(2023, 3, 30);
    const daysBetweenTwoDates = getSemimonthlyDaysBetweenTwoDates(firstDate, secondDate);
    console.log(daysBetweenTwoDates) // 3
    // 31/Mar/2023, 15/Apr/2023, 28/Apr/2023 

getPayDaysInMont

Example 1

    const dates = getPayDaysInMont(Month.April, 2023); 
    // 14/Apr/2023, 28/Apr/2023

Example 2

    const dates = getPayDaysInMont(Month.May, 2023); 
    // 15/May/2023, 31/May/2023

Authors

Contributing

Contributions are always welcome!

About

Calculate the number of pay days between 2 dates in a semimonthly pay schema

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published