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:
@@ -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) {
|
||||
|
||||
@@ -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 '';
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user