Skip to content

Array.from(range.by('month')) skips a last month #288

@ka-terok

Description

@ka-terok

Hello!

  1. I have
    start = 04.02.2020
    end = 1.03.2020 or 2.03.2020 or 3.03.2020

const range = moment.range(start, end)
When I do console.log(range) - it's ok

But then
let months = Array.from(range.by('months')).map(m => m.format('MMM'))
let days = Array.from(range.by('days')).map(m => m.format('DD MMM YYYY'))

at the end:
months = ['feb.'] - wrong
days = [04.02.2020 , ....] - it's ok

Even if I do
let months = Array.from(range.by('months', {excludeEnd: false})).map(m => m.format('MMM'))
at the end: months = ['feb.'] - wrong

But if
2)
start = 01.02.2020
end = 1.03.2020 or 2.03.2020 or 3.03.2020
at the end: months = ['feb.', 'mart'] - ok

What should I do to make 1 work?
It's my false or no?

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