I want to use range to set a cells value to a date.
What is the date literal expression that can be used in range.value() ?
For example:
var
book = $(
"#book"
).kendoSpreadSheet({}).data(
"kendoSpreadsheet"
);
var
sheet = book.activeSheet();
sheet.Range(
"A1"
)
.value( ... what spreadsheet date literal goes here ...)
.format(kendo.spreadsheet.formats.date)
;
I have been able to use a formula to put a date value in the cell
var
book = $(
"#book"
).kendoSpreadSheet({}).data(
"kendoSpreadsheet"
);
var
sheet = book.activeSheet();
var
dateTime =
new
Date (
"10/31/2017 12:00:00 AM"
);
var
dateMeth =
"=DATE("
+ dateTime.getFullYear() +
","
+ dateTime.getMonth() +
","
+ dateTime.getDay() +
")"
;
sheet.Range(
"A1"
)
.formula(dateMeth)
.format(kendo.spreadsheet.formats.date)
;
It works, but is ugly !
My actual problem is a little more complicated because I am doing this in a Razor based MVC view that has get the value from a DateTime field in the view model. The spreadsheet 'construction' is too complicated for using MVC HtmlHelpers.