Skip to main content Skip to footer

Disable Year from Date-Time Picker

To disable the year option in the date-time picker, override the "openDateTimePicker" command. Doing so, you can remove the HTML element for the year option and disable it. See the following code for an example:

let openDateTimePickerCommand = GC.Spread.Sheets.Commands.openDateTimePicker;
let oldExecute = openDateTimePickerCommand.execute;
openDateTimePickerCommand.execute = function () {
     let result = oldExecute.apply(this, arguments);
     let elements = document.querySelectorAll('.gc-year-select-div');
     elements.forEach((element) => {
        element.classList.add('disable-div');
     });
      return result;
   }

You can similarly disable other HTML elements this way.

Tye Glenz