Checks if the given date is between the given date range (inclusive).

Type signature

(from: Date, to: Date) => (date: Date) => boolean

Examples

dateInRange(
  new Date(
    "2018-06-10T12:00:00.000Z",
  ),
  new Date(
    "2018-06-20T12:00:00.000Z",
  ),
)(
  new Date(
    "2018-06-15T12:00:00.000Z",
  ),
);
// ⇒ true
Try in REPL

Questions

  • How to check if a date is within a given date range?

TypeScript sourceJavaScript source