Posted 22 May 2012 Link to this post
data-bind=
"text: getDate(selectedBlock.data.EndDate)"
Posted 25 May 2012 Link to this post
You cannot have *any* executable code in the data-bind attribute. You can only specify field and function names which correspond to model fields/functions. You can find more info in the ObservableObject help topic: http://www.kendoui.com/documentation/framework/mvvm/observableobject.aspx To format a date you need to create a calculated field - a function which will return date formatted the right way.
Posted 28 May 2012 Link to this post
You need to have one for every date property.
//Date Binding
kendo.data.binders.date = kendo.data.Binder.extend({
init:
function
(element, bindings, options) {
kendo.data.Binder.fn.init.call(
this
, element, bindings, options);
.dateformat = $(element).data(
"dateformat"
);
},
refresh:
() {
var
data =
.bindings[
"date"
].get();
if
(data) {
dateObj =
new
Date(data);
$(
.element).text(kendo.toString(dateObj,
.dateformat));
}
});
<
li
>Last Updated:<
span
data-bind
=
"date: selectedBlock.LastUpdated"
data-dateformat
"dddd MMM dd, yyyy hh:mmtt"
></
>
"text: selectedBlock.LastUpdated"
Posted 30 May 2012 Link to this post
Looks ok to me: http://jsfiddle.net/korchev/urAPV/1/
Posted 19 Jul 2017 Link to this post