subMilliseconds.js 917 B

123456789101112131415161718192021222324
  1. import { addMilliseconds } from "./addMilliseconds.js";
  2. /**
  3. * The {@link subMilliseconds} function options.
  4. */
  5. /**
  6. * Subtract the specified number of milliseconds from the given date.
  7. *
  8. * @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).
  9. * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
  10. *
  11. * @param date - The date to be changed
  12. * @param amount - The amount of milliseconds to be subtracted.
  13. * @param options - An object with options
  14. *
  15. * @returns The new date with the milliseconds subtracted
  16. */
  17. export function subMilliseconds(date, amount, options) {
  18. return addMilliseconds(date, -amount, options);
  19. }
  20. // Fallback for modularized imports:
  21. export default subMilliseconds;