A faster way to convert is to use JavaScript functions natively;
$scope.miFecha = new Date($scope.miFecha).toString()
$scope.miFecha = new Date($scope.miFecha).toString()
$scope.miFecha = new Date($scope.miFecha).toLocaleString()
$scope.miFecha = new Date($scope.miFecha).toLocaleDateString()
$scope.miFecha = new Date($scope.miFecha).toLocaleTimeString()
Or directly with the binding {{}},
You could do the following:
<div>
{{miFecha |date}}
{{miFecha |date : "dd.MM.y"}}
{{miFecha |date : "dd/MM/y" }}
{{miFecha |date : "dd-MM-y"}}
</div>
I'll give you an example:
link
Also in your main module you can place the following configuration
:
$mdDateLocaleProvider.formatDate = function(date) {
return date ? moment(date).format('DD/MM/YYYY') : '';
};
$mdDateLocaleProvider.parseDate = function(dateString) {
var m = moment(dateString, 'DD/MM/YYYY', true);
return m.isValid() ? m.toDate() : new Date(NaN);
};