Posted 1 March 2023, 4:30 pm EST
Hi,
how can I set the first day of the week to monday in the datepicker dropdown?
Thanks
Forums Home / Spread / SpreadJS
Posted by: christian.baumgartner on 1 March 2023, 4:30 pm EST
Posted 1 March 2023, 4:30 pm EST
Hi,
how can I set the first day of the week to monday in the datepicker dropdown?
Thanks
Posted 2 March 2023, 1:42 am EST
Hello,
As I can understand, you want to set Monday as the first day of the week in date time picker dropdown. You can do so by setting the startDay property of ICalendarOption interface object in dropdown to GC.Spread.Sheets.CalendarStartDay.monday.
Please refer to the code snippet and attached sample which explains the same.
let showTimeStyle = new GC.Spread.Sheets.Style();
showTimeStyle.cellButtons = [
{
imageType: GC.Spread.Sheets.ButtonImageType.dropdown,
command: “openDateTimePicker”,
useButtonStyle: true,
}
];
showTimeStyle.dropDowns = [
{
type: GC.Spread.Sheets.DropDownType.dateTimePicker,
option: {
showTime: true,
startDay: GC.Spread.Sheets.CalendarStartDay.monday,
}
}
];
sheet.setStyle(2, 5, showTimeStyle);
Sample: https://jscodemine.grapecity.com/share/MhUeX4_kfkylHJ_2uuC6kg/?defaultOpen={“OpenedFileName”%3A[“%2Findex.html”%2C"%2Fapp.js"]%2C"ActiveFile"%3A"%2Fapp.js"}
Please let us know if you still face any issues.
Doc reference
DateTimePicker dropdown demo: https://www.grapecity.com/spreadjs/demos/features/cells/drop-downs/date-time-picker/purejs
ICalenderOption interface: https://www.grapecity.com/spreadjs/api/v16/interfaces/GC.Spread.Sheets.ICalendarOption
IDropdwon interface: https://www.grapecity.com/spreadjs/api/v16/interfaces/GC.Spread.Sheets.IDropdown#interface-idropdown
Regards,
Avinash