Merge pull request #596 from willianveiga/feature/due-date-input-use-local-date-format

Due date input uses user's local date format
This commit is contained in:
Julius Härtl
2018-08-26 16:19:46 +02:00
committed by GitHub
2 changed files with 5 additions and 3 deletions

View File

@@ -30,9 +30,10 @@ app.directive('datepicker', function () {
return {
link: function (scope, elm, attr) {
return elm.datepicker({
dateFormat: 'yy-mm-dd',
dateFormat: moment.localeData().longDateFormat('L').replace('YYYY', 'YY').toLowerCase(),
onSelect: function(date, inst) {
scope.setDuedate(moment(date));
var selectedDate = $(this).datepicker('getDate');
scope.setDuedate(moment(selectedDate));
scope.$apply();
},
beforeShow: function(input, inst) {

View File

@@ -46,7 +46,8 @@ app.filter('dateToTimestamp', function() {
app.filter('parseDate', function() {
return function (date) {
if(moment(date).isValid()) {
return moment(date).format('YYYY-MM-DD');
var dateFormat = moment.localeData().longDateFormat('L');
return moment(date).format(dateFormat);
}
return '';
};