t} pickerState
   */
  sendPickerValueChangedImpl(type, pickerState) {
    let { year, month, day, hour, minute } = pickerState;
    if (month !== undefined) {
      // Month value from input box starts from 1 instead of 0
      month += 1;
    }
    switch (type) {
      case "time": {
        return { hour, minute };
      }
      case "date": {
        return { year, month, day };
      }
      case "datetime-local": {
        return { year, month, day, hour, minute };
      }
    }
    throw new Error(`Unexpected type ${type}`);
  }

  getCalendarInfo(locale) {
    const calendarInfo = Services.intl.getCalendarInfo(locale);

    // Day of week from calendarInfo starts from 1 as Monday to 7 as Sunday,
    // so they need to be mapped to JavaScript convention with 0 as Sunday
    // and 6 as Saturday
    function toDateWeekday(day) {
      return day === 7 ? 0 : day;
    }

    let firstDayOfWeek = toDateWeekday(calendarInfo.firstDayOfWeek),
      weekend = calendarInfo.weekend;

    let weekends = weekend.map(toDateWeekday);

    return {
      firstDayOfWeek,
      weekends,
    };
  }
}
PK