Author Topic: Date on dashboard  (Read 840 times)

0 Members and 1 Guest are viewing this topic.

Offline zmarfak

  • Contributor
  • ***
  • Posts: 135
    • Matar
Date on dashboard
« on: January 18, 2018, 03:21:00 PM »
Hi,
I'm new to the forum and I recently transformed my website to the use of the Saratoga templates.
I'm a novice regarding php and try to help myself to read and look for explanations on php.net.

Everything went fine with the setup and then I decided to give "realtime" a try.
I have Weatherlink 6.0.3 on my local computer and I have a Davis Vantage Pro2 station.

With the ajax script kicking in I noticed that the date format(after the word "updated") went from dd/mm/yy to mm/dd/yy on the dashboard

At the moment I changed in ajaxWLwx.js
Code: [Select]
var showDateMDY = true;     // set to false to show date as dd/mm/yyfrom false to true this was ok.

But that seems contradictory to the explanation in the file.
Maybe I missed something on other variables ?
I appreciate if anyone can give me a short explanation what I'm missing here.

The webpage : https://www.matar.be/weather/index.php


Patrick
Davis Vantage Pro2 with a Meteobridge NANO SD and WL (6.04) on a Intel NUC 
https://www.matar.be

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Date on dashboard
« Reply #1 on: January 18, 2018, 04:27:53 PM »
Hi, and welcome to WXForum.net

On your site, a WLtags.php?sce=dump shows
Code: [Select]
$WX['stationDate'] = '18/01/18'; // Date on the Station
$WX['stationTime'] = '22:17'; // Time on the Station
which means that WeatherLink is using day/month/year as the format for the date.

In your Settings.php, you have
Code: [Select]
$SITE['WDdateMDY'] = false; // for weather software date format of month/day/year.  =false for day/month/year
which implies the date format is day/month/year (a mismatch).
Change Settings.php to have
Code: [Select]
$SITE['WDdateMDY'] = true; // for weather software date format of month/day/year.  =false for day/month/year
then the date decoding routines in PHP will work correctly.

Your WLrealtime.txt shows
Code: [Select]
18/01/18|22:21|.... so the date there is also in day/month/year format.

In ajaxWLwx.js you have code
Code: [Select]
var showDateMDY = true;     // set to false to show date as dd/mm/yy
later in that script is
Code: [Select]
if(!showDateMDY) { ajaxdateformat = tdate[1]+"/"+tdate[0]+"/"+tdate[2];  } which with your current setting, will reverse the day/month fields and display month/day/year .. not what you want.  So, change ajaxWLwx.js to
Code: [Select]
var showDateMDY = false;     // set to false to show date as dd/mm/yy
With those two changes (Settings.php and ajaxWLwx.js), your date should remain as day/month/year format with both PHP and AJAX updates.
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 zmarfak

  • Contributor
  • ***
  • Posts: 135
    • Matar
Re: Date on dashboard
« Reply #2 on: January 18, 2018, 04:54:20 PM »
The eye of the Master !

I knew there would be a mismatch somewhere, I need to check more carefully in the future. ](*,)

Thanks for the help and the quick response.
The dates are ok now.
Patrick
Davis Vantage Pro2 with a Meteobridge NANO SD and WL (6.04) on a Intel NUC 
https://www.matar.be

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Date on dashboard
« Reply #3 on: January 18, 2018, 05:05:17 PM »
..but not infallable.

I steered you wrong a bit.  Settings.php needs to have
Code: [Select]
$SITE['WDdateMDY'] = false; // for weather software date format of month/day/year.  =false for day/month/year
since you are supplying the date via WeatherLink in day/month/year form.

Sorry about that.. too many negatives for aging eyes.
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 zmarfak

  • Contributor
  • ***
  • Posts: 135
    • Matar
Re: Date on dashboard
« Reply #4 on: January 18, 2018, 05:27:52 PM »
Ken,
I came to the same conclusion because on my status screen the date was completely wrong for "WeatherLink weather data"
see attachment

I have now in ajaxWLwx.js
Code: [Select]
var showDateMDY = false;     // set to false to show date as dd/mm/yy
and in  Settings.php
Code: [Select]
$SITE['WDdateMDY'] = false; // for weather software date format of month/day/year.  =false for day/month/year
but back the problem in the dashboard.
So I miss something ...

wrong attachment
Patrick
Davis Vantage Pro2 with a Meteobridge NANO SD and WL (6.04) on a Intel NUC 
https://www.matar.be

Offline zmarfak

  • Contributor
  • ***
  • Posts: 135
    • Matar
Re: Date on dashboard
« Reply #5 on: January 18, 2018, 05:29:58 PM »
correct attachment now
Patrick
Davis Vantage Pro2 with a Meteobridge NANO SD and WL (6.04) on a Intel NUC 
https://www.matar.be

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Date on dashboard
« Reply #6 on: January 18, 2018, 05:38:15 PM »
Ok, I'm obviously caffeine deficient..

I read the AJAX code wrong.. it really needs to have ajaxWLwx.js have
Code: [Select]
var showDateMDY = true;     // set to false to show date as dd/mm/yy
due to
Code: [Select]
if(!showDateMDY) { ajaxdateformat = tdate[1]+"/"+tdate[0]+"/"+tdate[2];  }
I'd overlooked (not seen) the ! in the test.  With showDateMDY=true, the code wouldn't execute and since you're already in day/month/year in WeatherLink, the swap of day/month positions wouldn'd happen.  D'oh!  So many double negatives to digest.

With Settings.php $SITE['WDdateMDY'] = false; the wxstatus.php page is showing correctly for the weather data age (whew!)
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 zmarfak

  • Contributor
  • ***
  • Posts: 135
    • Matar
Re: Date on dashboard
« Reply #7 on: January 18, 2018, 05:49:57 PM »
OK, I changed it.
It's ok now.

And now I also know the reason why.

Thanks for the help.
Patrick
Davis Vantage Pro2 with a Meteobridge NANO SD and WL (6.04) on a Intel NUC 
https://www.matar.be