would you please help me to add $.datepicker.setDefaults( $.datepicker.regional[ "fr" ] );
to an angular ui-datepicker directive
here is a jsfiddle that I'm using as example
1 Answer
var datePicker = angular.module('app', []);
datePicker.directive('jqdatepicker', function() {
return {
restrict: 'A',
require: 'ngModel',
link: function(scope, element, attrs, ngModelCtrl) {
element.datepicker({
dateFormat: 'DD, d MM, yy',
onSelect: function(date) {
scope.date = date;
scope.$apply();
}
});
}
};
});
<script type="text/javascript" src="//code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript" src="//code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<link rel="stylesheet" type="text/css" href="//code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css">
<script type="text/javascript" src="//jqueryui.com/resources/demos/datepicker/i18n/datepicker-fr.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
<link rel="stylesheet" type="text/css" href="//codeorigin.jquery.com/ui/1.10.3/themes/redmond/jquery-ui.css">
<body ng-app="app">
<input type="text" ng-model="date" jqdatepicker />
<br/> {{ date }}
</body>
Add <script type="text/javascript" src="//jqueryui.com/resources/demos/datepicker/i18n/datepicker-fr.js"></script>
in your script