Skip to content
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

Test of time formatted in ISO standard #11

Merged
merged 1 commit into from
Jan 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Upcoming
--------

* Using ISO8601 for the default timestamp format. For existing functionality change the `timestamp_fmt` option to
`human`.

1.1
---
Expand Down
4 changes: 4 additions & 0 deletions skins/JSON/current_minimal.json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
},
"generation":
{
#if $Extras.timestamp_fmt is "human"
"time": "$current.dateTime.format("%a, %d %b %Y %H:%M:%S %Z")",
#else
"time": "$current.dateTime.format("%Y-%m-%dT%H:%M:%S%z")",
#end if
"generator": "weewx $station.version"
},
"current":
Expand Down
7 changes: 7 additions & 0 deletions skins/JSON/skin.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
[Extras]
# Format of the timestamp, defaults to ISO, also supports `human`
# Defined by python's datetime module https://docs.python.org/3/library/datetime.html
# iso - %Y-%m-%dT%H:%M:%S%z
# human - %a, %d %b %Y %H:%M:%S %Z
timestamp_fmt = iso

[CheetahGenerator]
# This section is used by the generator CheetahGenerator, and specifies
# which files are to be generated from which template.
Expand Down
4 changes: 4 additions & 0 deletions skins/JSON/weewx.json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
},
"generation":
{
#if $Extras.timestamp_fmt is "human"
"time": "$current.dateTime.format("%a, %d %b %Y %H:%M:%S %Z")",
#else
"time": "$current.dateTime.format("%Y-%m-%dT%H:%M:%S%z")",
#end if
"generator": "weewx $station.version"
},
"current":
Expand Down
Loading