Im trying to set the format of a date as 'dd/MM/yyyy' using angular's $filter in this way:
var toDate;
$scope.endDate = {
value: new Date(2013, 9, 22)
};
$scope.$watch('metric.value', function (newValue, oldValue) {
toDate = $filter('date')($scope.endDate,'dd/MM/yyyy');
console.log(toDate);
}
And the output of the console shows the following:
Object {value: Tue Oct 22 2013 00:00:00 GMT+0200 (Romance Daylight Time)}
How can I actually change it to the format dd/MM/yyyy and parse it to a String?