Skip to content

interval.range() with option to include the stop interval boundary #55

@EE2dev

Description

@EE2dev

If you have a begin and an end date and want to loop through every day including the end date with d3.utcDay.range(), my understanding is I would call:
d3.utcDay.range(new Date("2022-03-08"), nextDay(new Date("2022-04-13")))

with

function nextDay(currentDay) {
  let nextDay = new Date(currentDay);
  nextDay.setDate(currentDay.getDate() + 1);
  return nextDay;
}

If interval range would include an option exclusive which defaults to true, but can be set to false, then one could get the desired result easier.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions