Subtracts the given number of days from the given Date object.

Type signature

(sourceDate: Date, numberOfDays: number) => Date

Examples

subtractDays(
  new Date(
    "2019-01-15T13:54:33.232Z"
  ),
  1
);
// ⇒ new Date("2019-01-14T13:54:33.232Z")
Try in REPL

Questions

  • How to subtract days from a given date?

TypeScript sourceJavaScript source