This repository has been archived on 2025-07-07. You can view files and clone it, but cannot push or open issues or pull requests.
Files
eternos/frontend/style/node_modules/date-fns/subBusinessDays.mjs
2025-01-11 09:54:09 +03:00

29 lines
1.0 KiB
JavaScript

import { addBusinessDays } from "./addBusinessDays.mjs";
/**
* @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 function subBusinessDays(date, amount) {
return addBusinessDays(date, -amount);
}
// Fallback for modularized imports:
export default subBusinessDays;