File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 311311
312312 function customDateRange ( ) {
313313 $ ( '#fom-loading' ) . show ( ) ;
314- if ( document . getElementById ( "ps-start-date" ) . value ) {
315- startDate = formatDate ( document . getElementById ( "ps-start-date" ) . value ) ;
316- }
317- if ( document . getElementById ( "ps-end-date" ) . value ) {
318- endDate = formatDate ( document . getElementById ( "ps-end-date" ) . value ) ;
319- }
320- if ( document . getElementById ( "ps-start-date" ) . value && document . getElementById ( "ps-end-date" ) . value ) {
321- persistDateRange ( - 1 ) ;
322- getData ( ) ;
314+ const startDateVal = document . getElementById ( 'ps-start-date' ) . value ;
315+ const endDateVal = document . getElementById ( 'ps-end-date' ) . value ;
316+
317+ if ( ! startDateVal || ! endDateVal ) {
318+ alert ( 'Please select both start and end dates.' ) ;
319+ $ ( '#fom-loading' ) . hide ( ) ;
320+ return ;
323321 }
322+
323+ startDate = formatDate ( startDateVal ) ;
324+ endDate = formatDate ( endDateVal ) ;
325+
326+ persistDateRange ( - 1 ) ;
327+ getData ( ) ;
324328 }
325329
326330 function formatDate ( d , includeTime ) {
You can’t perform that action at this time.
0 commit comments