Skip to content

Commit 84408fb

Browse files
author
Mark
committed
fix date filter
1 parent e18fb8d commit 84408fb

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

api/app/Http/Controllers/Api/PostController.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,23 @@ public function index()
6363
});
6464
}
6565
if (Input::has('published_at_min')) {
66-
$posts->where('published_at', '>=', Input::get('published_at_min'));
66+
$posts = $posts->where('published_at', '>=', Input::get('published_at_min'));
6767
}
6868
if (Input::has('published_at_max')) {
69-
$posts->where('published_at', '<=', Input::get('published_at_max'));
69+
$posts = $posts->where('published_at', '<=', Input::get('published_at_max'));
7070
}
7171

7272
if (Input::has('created_at_min')) {
73-
$posts->where('created_at', '>=', Input::get('created_at_min'));
73+
$posts = $posts->where('created_at', '>=', Input::get('created_at_min'));
7474
}
7575
if (Input::has('created_at_max')) {
76-
$posts->where('created_at', '<=', Input::get('created_at_max'));
76+
$posts = $posts->where('created_at', '<=', Input::get('created_at_max'));
7777
}
7878
if (Input::has('updated_at_min')) {
79-
$posts->where('updated_at', '>=', Input::get('updated_at_min'));
79+
$posts = $posts->where('updated_at', '>=', Input::get('updated_at_min'));
8080
}
8181
if (Input::has('updated_at_max')) {
82-
$posts->where('updated_at', '<=', Input::get('updated_at_max'));
82+
$posts = $posts->where('updated_at', '<=', Input::get('updated_at_max'));
8383
}
8484

8585
$posts = $posts->simplePaginate(Input::get('limit', 50));

api/app/Http/Controllers/Api/UserController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ public function index()
5757
});
5858
}
5959
if (Input::has('created_at_min')) {
60-
$users->where('created_at', '>=', Input::get('created_at_min'));
60+
$users = $users->where('created_at', '>=', Input::get('created_at_min'));
6161
}
6262
if (Input::has('created_at_max')) {
63-
$users->where('created_at', '<=', Input::get('created_at_max'));
63+
$users = $users->where('created_at', '<=', Input::get('created_at_max'));
6464
}
6565

6666
$users = $users->simplePaginate(Input::get('limit', 50));

backend/src/app/components/user/user.list.controller.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@
7777
var deferred = $q.defer();
7878

7979
if (vm.filter.created_at !== '' && vm.filter.created_at !== null) {
80-
console.log(vm.filter.created_at);
8180
vm.filter.created_at_max = moment.tz(vm.filter.created_at, angularMomentConfig.timezone).utc().add(1, 'months').format('YYYY-MM-DD HH:mm:ss');
8281
vm.filter.created_at_min = moment.tz(vm.filter.created_at, angularMomentConfig.timezone).utc().add(1, 'days').format('YYYY-MM-DD HH:mm:ss');
8382
}

backend/src/app/components/user/user.list.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ <h3 class="box-title">{{ 'user.users' | translate }}</h3>
4444
<div class="form-group">
4545

4646
<div class="input-group">
47-
<input id="published_at" datepicker-popup="MM/yyyy" type="text"
47+
<input id="created_at" datepicker-popup="MM/yyyy" type="text"
4848
class="form-control"
49-
ng-model="listCtrl.filter.published_at"
49+
ng-model="listCtrl.filter.created_at"
5050
date-disabled="disabled(date, mode)"
5151
datepicker-mode="'month'"
5252
is-open="listCtrl.opened"

0 commit comments

Comments
 (0)