Skip to content

Commit

Permalink
[IMPAC-905] Formatted date using moment js for due_date filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Abdullah Shafiq committed Jun 25, 2018
1 parent ea8354c commit 48038a0
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,9 @@ module.controller('WidgetAccountsInvoicesListCtrl', ($scope, $q, ImpacRoutes, Bo
$scope.trxList.changeOverdueFilter = (overdueFilter) ->
return if overdueFilter == $scope.trxList.overdue
$scope.trxList.overdue = overdueFilter
todays_date = new Date()
formated_date = [todays_date.getFullYear(), (todays_date.getMonth() + 1), todays_date.getDate()].join('-')
todays_date = moment().format('YYYY-MM-DD')
$scope.trxList.params.filter.balance = 'gt 0' if overdueFilter == 'overdue'
$scope.trxList.params.filter.due_date = ['lte', formated_date].join(' ') if overdueFilter == 'overdue'
$scope.trxList.params.filter.due_date = "lte #{todays_date}" if overdueFilter == 'overdue'
delete $scope.trxList.params.filter.balance if overdueFilter == 'all'
delete $scope.trxList.params.filter.due_date if overdueFilter == 'all'
$scope.trxList.fetch()
Expand Down

0 comments on commit 48038a0

Please sign in to comment.