var Mapping = {
'EmployeeAttendances': {
key: function (ro) {
return ko.utils.unwrapObservable(ro.EmployeeId);
},
create: function (options) {
return new AttendanceDetail(options.data);
}
}
};
AttendanceDetail = function (data) {
var self = this;
ko.mapping.fromJS(data, Mapping, self);
self.WorkingHoures = ko.pureComputed(function () {
var TimeIn = new Date(self.TimeIn());
var TimeOut = new Date(self.TimeOut());
var timeDifference = TimeOut - TimeIn;
var seconds = Math.floor(timeDifference / 1000);
var minutes = Math.floor(seconds / 60);
var hours = Math.floor(minutes / 60);
var formattedResult = (minutes % 60) + " : " + hours;
return formattedResult
});
}
If I activate the function above, the model returns null. Can anyone help me, please?