v7.3.0

Month

A class which encapsulates a calendar view of a month, and offers information about the weeks and days within that calendar view.

  // December 2018 using Monday as week start
  const m = new Month({
      date         : '2018-12-01',
      weekStartDay : 1
  });

m.eachWeek((week, dates) => console.log(dates.map(d => d.getDate())))

Useful configs and functions

Config / Function Description
date Date the month encapsulates
weekStartDay First day of the week (0=Sun, 6=Sat)
eachWeek Iterate over each week with its dates
eachDay Iterate over each day in the month

See also

No results

Configs

Configs are options you supply in a configuration object when creating an instance of this class
  • Configure as true to have the visibleDayColumnIndex and visibleColumnCount properties respect the configured nonWorkingDays.

  • Non-working days as an object where keys are day indices, 0-6 (Sunday-Saturday), and the value is true. Defaults to nonWorkingDays.

  • Configure as true to always have the month encapsulate six weeks. This is useful for UIs which must be a fixed height.

    Has a corresponding runtime sixWeeks property.

  • The week start day, 0 meaning Sunday, 6 meaning Saturday. Defaults to weekStartDay.

Properties

Properties are getters/setters or publicly accessible variables on this class
    • dayCount : Number
      READONLY

      The number of days in the calendar for this month. This will always be a multiple of 7, because this represents the number of calendar cells occupied by this month.

    • endDate : Date
      READONLY

      The date of the last cell in the calendar view of this month.

    • firstDate : Date
      READONLY

      The first date of the current month.

    • lastDate : Date
      READONLY

      The last date of the current month.

    • Configure as true to always have the month encapsulate six weeks. This is useful for UIs which must be a fixed height.

      Has a corresponding sixWeeks config.

    • startDate : Date
      READONLY

      The date of the first cell in the calendar view of this month.

    • weekCount : Number
      READONLY

      The number of weeks in the calendar for this month.

    • weekLength : Number
      READONLY

      The number of visible days in the week as defined by the nonWorkingDays and hideNonWorkingDays options.

    Functions

    Functions are methods available for calling on the class

      Events

      Events are triggered for certain actions in this class and can be listened for to react to those actions in your code

      Event handlers

      Event handlers are callbacks called as a result of certain actions in this class

      Source path

      Core/util/Month.js

      Contents