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 {
|
return {
|
||||||
link: function (scope, elm, attr) {
|
link: function (scope, elm, attr) {
|
||||||
return elm.datepicker({
|
return elm.datepicker({
|
||||||
dateFormat: 'yy-mm-dd',
|
dateFormat: moment.localeData().longDateFormat('L').replace('YYYY', 'YY').toLowerCase(),
|
||||||
onSelect: function(date, inst) {
|
onSelect: function(date, inst) {
|
||||||
scope.setDuedate(moment(date));
|
var selectedDate = $(this).datepicker('getDate');
|
||||||
|
scope.setDuedate(moment(selectedDate));
|
||||||
scope.$apply();
|
scope.$apply();
|
||||||
},
|
},
|
||||||
beforeShow: function(input, inst) {
|
beforeShow: function(input, inst) {
|
||||||
|
|||||||
@@ -46,7 +46,8 @@ app.filter('dateToTimestamp', function() {
|
|||||||
app.filter('parseDate', function() {
|
app.filter('parseDate', function() {
|
||||||
return function (date) {
|
return function (date) {
|
||||||
if(moment(date).isValid()) {
|
if(moment(date).isValid()) {
|
||||||
return moment(date).format('YYYY-MM-DD');
|
var dateFormat = moment.localeData().longDateFormat('L');
|
||||||
|
return moment(date).format(dateFormat);
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user