timepiece/node_modules/date-fns/subBusinessDays.d.mts

25 lines
941 B
TypeScript

/**
* @name subBusinessDays
* @category Day Helpers
* @summary Substract the specified number of business days (mon - fri) to the given date.
*
* @description
* Substract the specified number of business days (mon - fri) to the given date, ignoring weekends.
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
* @param date - The date to be changed
* @param amount - The amount of business days to be subtracted.
*
* @returns The new date with the business days subtracted
*
* @example
* // Substract 10 business days from 1 September 2014:
* const result = subBusinessDays(new Date(2014, 8, 1), 10)
* //=> Mon Aug 18 2014 00:00:00 (skipped weekend days)
*/
export declare function subBusinessDays<DateType extends Date>(
date: DateType | number | string,
amount: number,
): DateType;