Saratoga: WDdateMDY setting confusing for US users

Issue #22 resolved
nincehelser created an issue

This is the default line from Saratoga's Settings.php

$SITE['WDdateMDY'] = true; // for WD date format of month/day/year. =false for day/month/year

Currently we need to change this to "false" to make weewx-WD show the correct date (otherwise it displays December 31, 1969).

While fixing the problem date problem, it doesn't make sense for the US where dates are normally expressed month/day/year.

It's very confusing

Comments (27)

  1. Gary Roderick

    George, 'WDdateMDY' purely tells the Saratoga templates what format to expect dates in, it has little to do with how dates are displayed on the Saratoga web pages. (Clearly it does affect the display because if you have it set incorrectly then Saratoga attempts to make sense of nonsense input). 'dateOnlyFormat' sets the format that Saratoga uses to display dates, for those in the US I would expect it to be some sort of M/D/Y format; for those of us in Australia I use a D/M/Y based format.

  2. nincehelser reporter

    OK, let me phrase this another way:

    Why make this go counter to the Saratoga defaults? It's not exactly intuitive that one would need to change this to an unusual (for the US) date format.

  3. Gary Roderick

    Ok, I see what you are saying, though to hard code the weewxWD dates in M/D/Y now makes it un-intuitve for us here :) Just thinking off the cuff, perhaps the solution is to not in fact hard code the dates (except for day only, month only, year only tags) but rather let the user select what format they want. I notice that Tom has some date/time formats in the Weewx standard skin.conf that are also in the weewxWD skin.conf. Should be easy enough to use them and that way we both have something that is intuitive. It will add another (minor) step to the setup though. Thoughts?

  4. nincehelser reporter

    That sounds like a solution.

    Or is it possible to hardcode ISO 8601 (YYYY-MM-DD) format and take the user's "choice" out of their hands? I guess that's not practical unless you got Saratoga to go along with it, too.

  5. Gary Roderick

    Agree. Certainly possible to hard code ISO 8601 but it will break Saratoga as it only accepts MDY or DMY. I will discuss the skin.conf date formats with Greg and go from there.

  6. Gary Roderick

    Commit 283b10e provides the ability to set testtags.php date/time formats through skin.conf. Note that updated skin.conf, testtags.php.tmpl and wdtags.py are required. Date/time formats can be changed by editing [Units]TimeFormats in skin.conf. Weewx will require stop/start to effect these changes. Only change to skin.conf has been in [Units]TimeFormats section in case you have customized skin.conf. Note that whilst there are numerous date/time format strings that can be used in skin.conf, only a small number will provide date(in particular)/time tags that Saratoga can interpret correctly. Notes have been included against the settings in skin.conf listing those format strings I believe will work. I may be wrong with some of these so some fine tuning may be required. In summary, you need skin.conf set to provide testtags.php date/time formats in a format that Saratoga will accept. Saratoga Settings.php will need $SITE['WDdateMDY'] to be set as per the format you have set in skin.conf for weewxwd to provide. Settings.php $SITE['dateOnlyFormat'] will then need to be set to the format you wish to display on your site. Issues. Testtags.php has a number of vagaries (inconsistencies ?) so there may be a few tags that misbehave but most should work fine. If any odd dates/times show up please let us know. It is possible the scrolling display may also display the wrong/old date format. I have yet to look at clientraw.txt.

  7. Fernando

    gjr,

    I have the latest commit in place. My date is not changing from 28/6/2013. I have it set on settings to 6/28/2013 not sure why is not showing that way

  8. Gary Roderick

    Hmm, I can see your testtags.php contents and you are right of course. I just changed my setting in skin.conf and the testtags.php dates reversed day and month. Just to be absolutely sure, in skin.conf under [Units]TimeFormats you have date_f set to %m/%d/%Y or %-m/%-d/%Y? If so something is clearly not working properly and I think I will need to send you a version of testtags.php.tmpl that dumps a few variables so we can see what is happening.

  9. nincehelser reporter

    I just made the change of date_f to %-m/%-d/%Y.

    That fixes the problem for me.

    It took some time for that to work its way out through the system, so be patient. (I'm using 1 minute updates, and it took about 2 or 3 minutes before I saw results)

  10. Fernando

    Ok the front page did change but the Update date still shows "28/6/2013" and the trends also show the same format..

  11. nincehelser reporter

    Hmmm.... I seem to be OK in those locations. Did you try ctrl-F5 to make sure you're not pulling anything old from your cache?

  12. Gary Roderick

    Ok, I can see both your testtags.php, George's is fine but xcom7 you must have some settings out of whack. Can you post the TimeFormats section from your skin.conf. Also can you post your $SITE['WDdateMDY'] and $SITE['dateOnlyFormat'] settings from Settings.php.

  13. Gary Roderick

    OK, I see the problem. date_f must accord with $SITE['WDdateMDY']. It doesn't really matter what date format weewxwd and Saratoga expect between each other but they must be the same. So if date_f is %d/%m/%Y then $SITE['WDdateMDY'] must be set false, if date_f is %m/%d/%Y then $SITE['WDdateMDY'] must be set true. Of course (I believe) you can use %-d or %-m in lieu of %d and %m to get rid of leading zeroes if you wish. day_f should be either %d or %-d. So you need to change date_f and day_f. I see you also have date_time_f in a d/m/y format, you may wish to consider putting it in a m/d/y format if that is what you intend to display. Once you have made the changes and testtags.php has regenerated a page reload should see a marked improvement. To make things a little clearer I will amend the install instructions on bitbucket overview. With (effectively) 3 different sets of date/time settings to juggle it is not a simple process. The price of flexibility I guess!

  14. Fernando

    gjr,

    Thanks for pointing this out. I have made the changes. I am now waiting for the new page to regenerate.

    Thanks!

  15. Gary Roderick

    Looks better but still a few issues. I can see your testatgs.php appears to be correct (from a cursory glance). Maybe some vagaries in testtags.php that I have not picked up on. Need to study the Saratoga code I think....

  16. Gary Roderick

    Have just committed revised testtags.php.tmpl, skin.conf and readme.md. No need to download as only real changes are tying together date/time format instructions in skin.conf and readme.md and making testtags.php.tmpl more robust to date/time format settings. Hopefully weewx-wd overview should have some clearer instructions re setting date/time formats so they work with Saratoga. Testtags.php will now have a comment up front that shows date/time format codes.

  17. Oz Greg repo owner

    It appears the latest updates have invalided the

    // Units // ----- $uomtemp = ''; // = 'C', 'F', (or 'C', 'F', or '°C', '°F' ) $uombaro = ''; // = 'inHg', 'hPa', 'kPa', 'mb' $uomwind = ''; // = 'kts','mph','kmh','km/h','m/s','Bft' $uomrain = ''; // = 'mm', 'in' $datefmt = 'd/m/y%'; // = 'd/m/y', 'm/d/y' $uomdistance = 'km'; // = 'mi','km' (for windrun variables)

  18. Gary Roderick

    xcom7, judging by your site I think you still have day_f set to %-m/%-d/%Y - it should be just %-d or %d - that will clear up the Gust Month date problem. As far as I can tell the rest of your dates/times are displaying as per the format settings in skin.conf. For info I committed a new clientraw.txt.tmpl that should fix the problem of your current wind speed being higher than your gust speed on wxtrends.php.

  19. Gary Roderick

    Ha, separate issue, have been concentrating on getting date/time working properly. Let me see how I go today...

  20. Gary Roderick

    xcom7, slightly off topic for this issue but I have just pushed a commit that fixes a few wxtrends.php wind issues, probably about as much as we can do now without writing some more python code. There are a number of issues re wind when using weewx to drive Saratoga with WD plugin, primarily due to differing wind data provided by weewx and WD. I intend to raise a separate issue re wind. In terms of this issue, I think we have the date format issue sorted and I intend to close this issue tonite unless I hear there are problems. PS. I note you still have the issue with wxtrends.php current wind speed and wind gust being transposed. Commit a429791 will fix this.

  21. Gary Roderick

    Good news. I will close this off now and raise another issue on the various wind tags that are still missing data.

  22. Log in to comment