Skip to content

Commit

Permalink
Due date input uses user's local date format
Browse files Browse the repository at this point in the history
Signed-off-by: Willian Gustavo Veiga <beberveiga@gmail.com>
  • Loading branch information
willianveiga committed Aug 25, 2018
1 parent b3b16f8 commit f8239f4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions js/directive/datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion js/filters/dateFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 '';
};
Expand Down

0 comments on commit f8239f4

Please sign in to comment.