-
-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hard coded time formats should use locale instead #56
Comments
poblabs
added a commit
that referenced
this issue
Feb 5, 2019
poblabs
added a commit
that referenced
this issue
Feb 5, 2019
poblabs
added a commit
that referenced
this issue
Feb 5, 2019
Applies to static or live webpage. Updates #56
poblabs
added a commit
that referenced
this issue
Feb 5, 2019
poblabs
added a commit
that referenced
this issue
Feb 5, 2019
poblabs
added a commit
that referenced
this issue
Feb 5, 2019
poblabs
added a commit
that referenced
this issue
Feb 6, 2019
poblabs
changed the title
Hard coded time formats should be user changeable
Hard coded time formats should use locale instead
Feb 6, 2019
poblabs
added a commit
that referenced
this issue
Feb 7, 2019
With that last commit, I believe all time formats are now using the station's locale. Closing. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Edit: TO DO:
<div class="updated">Last Updated
to use epoch owned by moment.jsstrftime
is in locale%x
or%c
style for locale formatting on the datetime.) I asked this question after spending a whole day getting nowhere (and ended up finding the answer on my own.Continued discussion from #1 and #46. I've long thought that the hard coded time formats should be in a user locale or user customizable. This could mean a bunch of new variables though if user customizable is an option. Not pretty - the skin is very variable heavy as it is. Need to try to keep this minimal but functional. Can weewx provide this somehow to Python and moment.js?
Python takes care of the date and time locale pretty well with the month names. Moment.js did not initially, but the latest commit also provides the system locale to moment.js.
Moment.js is used when your page automatically updates in the background when used with MQTT websockets.
Now it's just a matter of month and date formatting. It's different in many locations. Some are Month/Day, others are Day/Month. Some are double digit days (like 04), others are single digit days.
Here are the dates and timestamps used throughout the skin.
February 4, 2019, 11:31:17 am
(MQTT updates)Monday, February 15, 2019
(front page, weather snapshot)January 16, 2019, 11:17 AM EST
(earthquake)February 4, 2019, 11:15 AM
(forecast update time)February, 2019
(front page, weather snapshot)Tue 2/5
(forecast)6:59 AM
(sun and moon)Then there's the entire Records page to consider.
moment.js
formatting and Python'sstrftime
formatting are different. So this could mean 2 variables for each 1 format.Options are:
I think option 3 is probably the best bet. It reduces the number of variables needed to configure.
I'm going to start thinking about this and applying commits against the code to try and satisfy localization of dates and time.
As of faebea5, the 2 below are consolidated into the same format. No variable yet.
Looks like these are what's left to update to locale:
Monday, February 15, 2019
(front page, weather snapshot)Month and Year seem to be universal so this might not need a variable?
Need to determine how to have interop between Python
strftime
andmoment.js
?Option 3 would also satisfy a lot of the records page.
Am I making this too hard on myself? Should I be using
%x
and%c
?Complete:
LL, LTS
from moment.js. Long timestamp 1 for MQTT which includes seconds. Important for rapidfire websites: February 4, 2019, 11:31:17 amThe text was updated successfully, but these errors were encountered: