Skip to content

range.by('month') excluding last month in range #282

@razzp

Description

@razzp

I have a date range that starts in June and runs through July and into August. Creating an iterable of months in the range yields only the first two months. August is not included.

Steps to Reproduce

const range = moment.range('2020-06-23', '2020-08-21');
const months = Array.from(range.by('months')).map(date => date.format('MMMM'));
console.log(months);

Expected Behavior

Array [ "June", "July", "August" ]

Current Behavior

Array [ "June", "July" ]


moment.js 2.27.0
moment-range 4.0.2

Unless I'm missing something this seems to be a bug. Explicitly setting { excludeEnd: false } doesn't work either.

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