SpreadJS offers built in cell dropdowns which includes a Date Time Picker. This dropdown allows end users to select a date but by default this cell dropdown will capture a time stamp. To avoid capturing the time stamp, SpreadJS users can implement a custom command to only get the date when the end user submits the selected date.
Steps to Complete:
Create a custom command
Register the custom command
Create and applied the cell dropdown
Step 1: Create a custom command
To capture only the date, we must first create a custom command to get only the date. The command will then set a new value which will contain the capture date:
Step 2: Register the custom command
When creating custom commands, they must be registered to the command manager. We will register the submitDateWithoutTime command like so:
Step 3: Create and apply the cell dropdown
Next, we will create the style for the Date Time Picker dropdown with the showTime option set to False and the submitCommand will use our custom command, submitDateWithoutTime.
Finally, we will set date time picker and apply a date formatter to the same cell to set the format of how the date is to be formatted:
With this code logic applied, the cell dropdown will now only capture and display the selected date, the time stamp is not observable:
Here is a link to a live sample showing this: https://codesandbox.io/s/sjs-js-custom-date-time-picker-date-only-vmuio?file=/index.html