Skip to content

Initialization intervalEnd error with more than one month #371

@rdavid2

Description

@rdavid2

Context

Initialization of intervalEnd is incorrect with more than one month visible. Returns the end day of the first month, not the end day of the last month.

There is no way to get the start date of the first month and the end of the last month before clicking the next or previous button

Expected Behavior

The last day of the last month, the same as if you click on next or previous

Actual Behavior

Returns the end day of the first month

Possible Fix

I think the wrong code is this, delete it?

if (this.options.startWithMonth) {
            this.month = moment(this.options.startWithMonth).startOf('month');
            this.intervalStart = moment(this.month);
            this.intervalEnd = this.options.lengthOfTime.days
                ? moment(this.month)
                    .add(this.options.lengthOfTime.days - 1, 'days')
                    .endOf('day')
                : moment(this.month).endOf('month');
        }

Steps to Reproduce

  1. Initialize the calendar with 3 monts and startWithMonth
  2. Get this.intervalEnd in ready callback

Your Environment

  • Version used: 1.5.1
  • Browser Name and version:
  • Operating System and version (desktop or mobile):
  • Link to your project:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions