Author Topic: 01/01/1970 and Warmest / Coldest Day  (Read 517 times)

0 Members and 1 Guest are viewing this topic.

Offline gand

  • Senior Member
  • **
  • Posts: 61
    • Lynghuzed
01/01/1970 and Warmest / Coldest Day
« on: May 17, 2021, 10:19:36 PM »
Hi
I have just installed the World Saratoga template and I'm using the WeeWx plugin. Everything seems to be fine except the Warmest / Coldest Day on the trend page. See screenshot.

The system is right now running local, so I can't provide an external link.

Could someone point me in the the right direction, where to start looking.

I have also attached the files genereated by  WeeWx.

Thanks
Gert


Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: 01/01/1970 and Warmest / Coldest Day
« Reply #1 on: May 18, 2021, 12:53:45 AM »
The variables doing that display in WEEWXtags.php are
Code: [Select]
$mcoldestdayonrecord = '17,4C on: 17 maj 2021';
$mcoldestnightonrecord = '8,4C on: 17 maj 2021';
$mwarmestdayonrecord = '17,4C on: 17 maj 2021';
$mwarmestnightonrecord = '9,9C on: 16 maj 2021';

The result of 1/1/1970 is due to 'maj' instead of 'May' in the data.
Have you setup Settings.php to have
Code: [Select]
$SITE['monthNames'] = array(  // for wxastronomy page .. replace with month names in your language
"januar","februar","marts","april","maj","juni",
"juli","august","september","oktober","november","december");
PHP (by default) expects the month names to be in English, and your data appears to have Danish month names.. add the above to Settings.php to replace the English default, and the dates should display correctly there and on the wxastronomy.php page too.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline gand

  • Senior Member
  • **
  • Posts: 61
    • Lynghuzed
Re: 01/01/1970 and Warmest / Coldest Day
« Reply #2 on: May 18, 2021, 01:04:29 AM »
Hi

Thanks for looking. I did change that already and the astronomy page is fine.

Settings:
Quote
// if your software uploads almanac dates using a language OTHER THAN English, please put the month
// names in your language to replace the English ones below.  This is used primarily by the
// wxastronomy.php page for the local dates of moon phases, solistices, and equinoxes
// $SITE['monthNames'] = array(  // for wxastronomy page .. replace with month names in your language
// 'January','February','March','April','May','June',
// 'July','August','September','October','November','December'
// );
// example:
$SITE['monthNames'] = array(  // Danish for wxastronomy page .. replace with month names in your language
'januar','februar','marts','april','maj','juni',
'juli','august','september','oktober','november','december'
);

Gert

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: 01/01/1970 and Warmest / Coldest Day
« Reply #3 on: May 18, 2021, 01:06:43 AM »
I just looked at WEEWX-trends-inc.php and noticed it was missing the get_localdate() function used in wxastronomy.php

I'll add a function to that and post it later.. it's bedtime now for me :)
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: 01/01/1970 and Warmest / Coldest Day
« Reply #4 on: May 18, 2021, 02:46:53 PM »
Try the attached.  It should just display the date as in the WEEWXtags.php if non-English dates are found.

I was thinking of doing the full translation (as done in wxastronomy), but.. the $SITE['monthNames'] only has the FULL names, not the abbreviations used, and it's chancy to assume 3 characters is the right number for abbreviated date names in other languages.
So.. I took the easy route: if your're running WeeWX with a non-English locale, the date format of that locale will display for those record entries on wxtrends.php
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline gand

  • Senior Member
  • **
  • Posts: 61
    • Lynghuzed
Re: 01/01/1970 and Warmest / Coldest Day
« Reply #5 on: May 18, 2021, 04:19:20 PM »
Hi Ken

Thanks a lot, working perfect.

Some more testing and I'll upload to my webserver with rsync.

Gert

Offline k8tek

  • Member
  • *
  • Posts: 7
Re: 01/01/1970 and Warmest / Coldest Day
« Reply #6 on: March 16, 2024, 10:27:28 AM »
https://ballcock.us

I hate to keep bothering the developer, but I'm not sure how to fix the warmest / coldest day info on my site.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: 01/01/1970 and Warmest / Coldest Day
« Reply #7 on: March 16, 2024, 11:09:42 AM »
Are you refering to the dates shown on https://ballcock.us/wxrecordsalltime.php ?  If so, that's an add-on page from a 3rd party.. not part of the Saratoga template set.  Your https://ballcock.us/wxtrends.php (Saratoga template page) does show data there correctly for warmest/coldest days.

In the wxrecordsalltime.php page from Eastmasonville it has
Quote
  list($warmestdayonrecord_temp, $date) = explode('  on: ', $warmestdayonrecord);
   $date = strtotime($date);
   $warmestdayonrecord_date = date($dateOnlyFormat,$date);
   
   list($warmestnightonrecord_temp, $date) = explode('  on: ', $warmestnightonrecord);
   $date = strtotime($date);
   $warmestnightonrecord_date = date($dateOnlyFormat,$date);
   
   list($coldestdayonrecord_temp, $date) = explode('  on: ', $coldestdayonrecord);
   $date = strtotime($date);
   $coldestdayonrecord_date = date($dateOnlyFormat,$date);
   
   list($coldestnightonrecord_temp, $date) = explode('  on: ', $coldestnightonrecord);
   $date = strtotime($date);
   $coldestnightonrecord_date = date($dateOnlyFormat,$date);
and the source data in WEEWXtags.php doesn't have the $warmest*/$coldest* variables in it.  The Weather-Display testtags.php does (and that page was written for Weather-Display).
« Last Edit: March 16, 2024, 11:16:47 AM by saratogaWX »
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP