@@ -14,6 +14,8 @@ angular.module('oncokbApp')
14
14
$scope . typeCheckboxes = [ 'update' , 'name change' , 'add' , 'delete' ] ;
15
15
$scope . selectedTypeCheckboxes = [ ] ;
16
16
$scope . dateRange = { startDate : null , endDate : null } ;
17
+ $scope . dateRangeStartDateStr = null ;
18
+ $scope . dateRangeEndDateStr = null ;
17
19
$scope . dateRangeOptions = {
18
20
ranges : {
19
21
'Last 7 Days' : [ moment ( ) . subtract ( 6 , 'days' ) , moment ( ) ] ,
@@ -33,6 +35,7 @@ angular.module('oncokbApp')
33
35
} ) ;
34
36
} ;
35
37
var sorting = [ [ 2 , 'desc' ] , [ 1 , 'asc' ] , [ 0 , 'asc' ] ] ;
38
+ var dateRangeFormat = 'YYYY-MM-DD HH:mm:ss ZZ' ;
36
39
37
40
$scope . dtOptions = DTOptionsBuilder
38
41
. newOptions ( )
@@ -46,6 +49,15 @@ angular.module('oncokbApp')
46
49
DTColumnDefBuilder . newColumnDef ( 2 ) . withOption ( 'sType' , 'date' ) ,
47
50
DTColumnDefBuilder . newColumnDef ( 3 )
48
51
] ;
52
+
53
+ $scope . $watch ( 'dateRange' , function ( n ) {
54
+ if ( n . startDate ) {
55
+ $scope . dateRangeStartDateStr = n . startDate . format ( dateRangeFormat ) ;
56
+ }
57
+ if ( n . endDate ) {
58
+ $scope . dateRangeEndDateStr = n . endDate . format ( dateRangeFormat ) ;
59
+ }
60
+ } ) ;
49
61
$scope . $watch ( 'ugtData.gene' , function ( n ) {
50
62
if ( $scope . ugtData . firebaseGeneUnbind ) {
51
63
$scope . ugtData . firebaseGeneUnbind ( ) ;
@@ -142,7 +154,7 @@ angular.module('oncokbApp')
142
154
$scope . searchHistory = function ( genesForHistory ) {
143
155
$scope . errorMessage = '' ;
144
156
$scope . historySearchResults = [ ] ;
145
- if ( ( ! $scope . dateRange . startDate || ! $scope . dateRange . endDate ) &&
157
+ if ( ( ! $scope . dateRangeStartDateStr || ! $scope . dateRange . dateRangeEndDateStr ) &&
146
158
( ! _ . isArray ( $scope . genesForHistory ) || $scope . genesForHistory . length === 0 ) &&
147
159
$scope . selectedTypeCheckboxes . length === 0 ) {
148
160
$scope . errorMessage = 'Please choose conditions from Gene, Date or Type.' ;
@@ -152,11 +164,10 @@ angular.module('oncokbApp')
152
164
var startTimestamp = 0 ;
153
165
var endTimestamp = 0 ;
154
166
var hasDateRange = false ;
155
- if ( $scope . dateRange . startDate && $scope . dateRange . endDate ) {
167
+ if ( $scope . dateRangeStartDateStr && $scope . dateRangeEndDateStr ) {
156
168
hasDateRange = true ;
157
- startTimestamp = new Date ( $scope . dateRange . startDate . format ( 'YYYY-MM-DD' ) ) . getTime ( ) ;
158
- var endDate = moment ( $scope . dateRange . endDate ) . add ( 1 , 'days' ) ;
159
- endTimestamp = new Date ( endDate . format ( 'YYYY-MM-DD' ) ) . getTime ( ) ;
169
+ startTimestamp = new Date ( $scope . dateRangeStartDateStr ) . getTime ( ) ;
170
+ endTimestamp = new Date ( $scope . dateRangeEndDateStr ) . getTime ( ) ;
160
171
}
161
172
loadFiles . load ( 'history' ) . then ( function ( success ) {
162
173
var historyResults = [ ] ;
0 commit comments