Ero sivun ”Widget:XJwCharts” versioiden välillä
Järvi-meriwikistä
Rivi 36: | Rivi 36: | ||
obs.data = JSON.parse( obs.printouts.DataJSON ); | obs.data = JSON.parse( obs.printouts.DataJSON ); | ||
− | + | if ( obs.obsdatetime.getMonth() > -1 && obs.obsdatetime.getMonth() < 8 ) { | |
− | if ( obs.obsdatetime.getMonth() > -1 && obs.obsdatetime.getMonth() < 8 ) { winter- | + | obs.winter = obs.obsdatetime.getFullYear()-1; |
− | + | obs.comparedate = new Date( now.getFullYear()+1, obs.obsdatetime.getMonth(), obs.obsdatetime.getDate() ); | |
− | + | } else { | |
− | var days = ( | + | obs.winter = obs.obsdatetime.getFullYear(); |
+ | obs.comparedate = new Date( now.getFullYear(), obs.obsdatetime.getMonth(), obs.obsdatetime.getDate() ); | ||
+ | } | ||
+ | |||
+ | var days = ( obs.comparedate.getTime() - now.getTime() ) / ( 1000*60*60*24 ); | ||
firstW = Math.min( firstW, winter ); lastW = Math.min( lastW, winter ); | firstW = Math.min( firstW, winter ); lastW = Math.min( lastW, winter ); | ||
− | if ( typeof data[ winter ] == 'undefined' ) { data[ winter ] = { 'winter': winter }; } | + | if ( typeof data[ obs.winter ] == 'undefined' ) { data[ obs.winter ] = { 'winter': obs.winter }; } |
if ( obs.data.cat == 2 ) { | if ( obs.data.cat == 2 ) { | ||
− | data[ winter ].freeze = days; | + | data[ obs.winter ].freeze = days; |
} else if ( obs.data.cat == 5 ) { | } else if ( obs.data.cat == 5 ) { | ||
− | data[ winter ].breakup = days; | + | data[ obs.winter ].breakup = days; |
} | } | ||