Welcome to the Cumulus Support forum.

Latest Cumulus MX V4 release 4.2.1 (build 4043) - 19 October 2024

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

month gust

Discussion of Ken True's web site templates

Moderator: saratogaWX

Post Reply
User avatar
vpokroglo
Posts: 111
Joined: Thu 24 Feb 2011 7:45 pm
Weather Station: WS-2350
Operating System: Raspberry Pi 2
Location: Slovenija
Contact:

month gust

Post by vpokroglo »

why does ajax dashboard always displays month name of biggest wind gust as Januar, doesn't matter we are november or any other month? I also noticed that language selector doest work either.
my site: https://okroglovreme.com/
Image
User avatar
saratogaWX
Posts: 1222
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: month gust

Post by saratogaWX »

So, two issues. Regarding the Month gust max display, it is produced by ajax-dashboard.php using

Code: Select all

              <?php if(isset($mrecordwindgust)) { ?>
              <tr>
                <td colspan="2" class="data1" align="center">
				  <?php langtrans('Gust Month'); ?>: <?php echo $mrecordwindgust. " $uomWind"; ?> 
                  <?php if(isset($mrecordhighgustday)) { ?>
				  <?php echo $monthname . " " . $mrecordhighgustday; ?> 
                  <?php } // $mrecordhighgustday ?>
				</td>
              </tr>
              <?php } // $mrecordwindgust ?>
those values are produced in CU-defs.php from

Code: Select all

$time  = substr($WX['time'],0,5); // calculated value
$date = $WX['date'];

# generate the separate date/time variables by dissection of input date/time and format
list($date_year,$date_month,$date_day,$time_hour,$time_minute,$monthname,$dayname)
  = CU_setDateTimes($date,$time,$SITE['WDdateMDY']);

$mrecordwindgust = $WX['MonthGustH'];
list($mrecordhighgustday,$mrecordhighgustmonth,$mrecordhighgustyear)=CU_getRecordDate($WX['MonthGustHD'],$WX['year']); // calculated value
In CUtags.php?sce=dump, the values above are

Code: Select all

$WX['date'] = '11. 11. 2023';
$WX['time'] = '22:25 on 11 november 2023';
$WX['year'] = '2023';
$WX['monthname'] = 'november';
$WX['MonthGustH'] = '69';
$WX['MonthGustHT'] = '19:58';
$WX['MonthGustHD'] = '02 november';
in CU-defs.php the

Code: Select all

#-------------------------------------------------------------------------------------
# CU support function - CU_getRecordDate - Convert 'dd Month '.'YYYY' to list(d,m,y)
#-------------------------------------------------------------------------------------

function CU_getRecordDate($inDayMonth,$inYear) {
  global $SITE,$Debug;
  
  $EnglishMonths = array(
   'January','February','March','April','May','June',
   'July','August','September','October','November','December');
   
  
  $tstr = $inDayMonth . ' ' . $inYear;
  $Debug .= "<!-- CU_getRecordDate input tstr='$tstr' -->\n";

 // input dates are assumed to be in English only
 if (isset($SITE['monthNames'])) {
    // convert TO English for strtotime()
	foreach ($EnglishMonths as $i => $monthEN) {
	   $tstr = preg_replace('|'.$SITE['monthNames'][$i].'|i',$monthEN,$tstr);
	}  
    $Debug .= "<!-- CU_getRecordDate after tstr='$tstr' -->\n";
  }

  $ttime = strtotime($tstr);
  $ltime = date('j n Y',$ttime);
  $Debug .= "<!-- CU_getRecordDate result ltime='$ltime' -->\n";
  return(explode(' ',$ltime));

}
is used to format the date. I think the issue is caused by

Code: Select all

$WX['date'] = '11. 11. 2023';
which should either be mm/dd/yyyy or dd/mm/yyyy -- the template doesn't understand the dd. mm. yyyy format.

For the 'unable to switch language' issue, I suspect it is the cookie consent script. Try commenting out

Code: Select all

<script src="https://cdn.jsdelivr.net/npm/cookieconsent@3/build/cookieconsent.min.js" data-cfasync="false"></script>
in your index.php and see if the language switch works again. When the script is engaged (even with 'Permit' enabled, the cookie for language is not updated).
Post Reply