I am using the angular-ui bootstrap datepicker across an application and it works very well. However the backend I am sending the dates to only accepts dates in a given format, sadly this format is not what is the default that is put on the model for the date picker.
To combat this issue I have a few if checks that I run through before I persist the model. This does not scale very well on forms that have multiple dates.
if ($scope.dateOfBirthStr) {
$scope.dateOfBirthStr = $filter('date')($scope.dateOfBirthStr, 'MM/dd/yyyy');
}
Without modifying the ui-datepicker itself is there an best practice I can use to format all the dates within a given model without having to call them out individually?