Ero sivun ”Widget:CitobsDBcounter” versioiden välillä
Järvi-meriwikistä
Rivi 29: | Rivi 29: | ||
var citobs = new CitobsOpen311(); | var citobs = new CitobsOpen311(); | ||
− | var days = 6; | + | //var days = 6; |
− | var startDate = new Date(); | + | //var startDate = new Date(); |
− | startDate.setDate( startDate.getDate()-days ); | + | //startDate.setDate( startDate.getDate()-days ); |
//var endDate = new Date(); | //var endDate = new Date(); | ||
//startDate.setDate( startDate.getDate()-days ); | //startDate.setDate( startDate.getDate()-days ); | ||
− | + | ||
− | citobs.loadRequests( { 'service_code': service_code, 'keyword': keyword, 'start_date': start_date }, function() { | + | console.log( start_date ); |
+ | |||
+ | var today = new Date(); | ||
+ | var weekago = new Date(); weekago.setDate( weekago.getDate() - 7 ); | ||
+ | |||
+ | if ( start_date == 'x' ) { start_date = weekago.toISOString().split( 'T' )[0]: } | ||
+ | if ( end_date == 'x' ) { end_date = today.toISOString().split( 'T' )[0]: } | ||
+ | |||
+ | citobs.loadRequests( { 'service_code': service_code, 'keyword': keyword, 'start_date': start_date, 'end_date': end_date }, function() { | ||
var c1 = 0; | var c1 = 0; | ||
var c2 = 0; | var c2 = 0; |