To use the addBusinessDays
function from the date-fns
library in TypeScript, you first need to install the library using npm:
21 chars2 lines
Then, you can import the function into your TypeScript file like this:
index.ts44 chars2 lines
You can now use the addBusinessDays
function in your code by passing in a date object and the number of business days you want to add to it:
index.ts151 chars3 lines
The addBusinessDays
function works by skipping over weekends (Saturday and Sunday) when adding the specified number of business days. If you pass in a negative number as the second argument, it will subtract that many business days instead.
index.ts155 chars3 lines
gistlibby LogSnag