logo

/repo|v2.1.3

Typedef

TimezoneOptions:

object

Timezone options of the calendar instance.

PROPERTIES
NameTypeDescription

zones

Array.<object>

Timezone data.

customOffsetCalculator

function

Custom offset calculator when you're not able to leverage API.

EXAMPLES
const calendar = new Calendar('#container', {
  timezone: {
    // @property {string} zones[].timezoneName - Timezone name. it should be one of IANA timezone names.
    // @property {string} [zones[].displayLabel] - Display label of timezone.
    // @property {string} [zones[].tooltip] - Tooltip of the element of the display label.
    zones: [
      {
        timezoneName: 'Asia/Seoul',
        displayLabel: 'UTC+9:00',
        tooltip: 'Seoul'
      },
      {
        timezoneName: 'Europe/London',
        displayLabel: 'UTC+1:00',
        tooltip: 'BST'
      }
    ],
    // This function will be called for rendering components for each timezone.
    // You don't have to use it if you're able to `Intl.DateTimeFormat` API with `timeZone` option.
    // this function should return timezone offset from UTC.
    // for instance, using moment-timezone:
    customOffsetCalculator: (timezoneName, timestamp) => {
      return moment.tz(timezoneName).utcOffset(timestamp);
    }
  }
});
Resizable