Hi everybody,
In our MVC application the view model has 2 datetime? properties. In JavaScript I am trying the following code:
$scope.startTime = $scope.currentmax4sale.startTime.getHours() + ':' + $scope.currentmax4sale.startTime.getMinutes();
because I'd like to construct time only (in 'HH:MM') format from that date. But it's failing with a message that getHours() is not a function.
So, how should I get my time in the right format after I got my model values back? The date looks like
"2010-11-13T00:00:00"
Thanks in advance. If I try to apply new Date(...) function to that date, then it's converting it to my local time, which is not what I want. I want it to use that string as date and not apply any conversions.
UPDATE: I've decided to put the conversion inside the .NET ViewModel instead.
If it's not broken, fix it until it is.
My Blog