diff options
author | Arjun Satarkar <me@arjunsatarkar.net> | 2023-07-30 13:06:11 +0000 |
---|---|---|
committer | Arjun Satarkar <me@arjunsatarkar.net> | 2023-07-30 13:06:11 +0000 |
commit | 24db878f08b150d2b61d4074374805550785700b (patch) | |
tree | 202782c14ed82e04145dde3ff7299dbb69efd0e7 /views | |
parent | 9689f2daa6c34e7d24d5cf1648168c66c5678385 (diff) | |
download | tagrss-24db878f08b150d2b61d4074374805550785700b.tar tagrss-24db878f08b150d2b61d4074374805550785700b.tar.gz tagrss-24db878f08b150d2b61d4074374805550785700b.zip |
Use <time> elements correctly
Give the datetime attribute the UTC time ending in "Z" as prescribed.
Before, we were giving it the local time in the server's time zone,
which is wrong if the client is in a different time zone. This does not
change what is visually presented in the browser.
Diffstat (limited to 'views')
-rw-r--r-- | views/index.tpl | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/views/index.tpl b/views/index.tpl index 67eb413..2114652 100644 --- a/views/index.tpl +++ b/views/index.tpl @@ -102,16 +102,17 @@ <td>{{i + 1 + offset}}</td> <td><a href="{{entry['link']}}">{{entry["title"]}}</a></td> <% - date = "" - if entry.get("epoch_published", None): - date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(entry["epoch_published"])) - end - if entry.get("epoch_updated", None): - date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(entry["epoch_updated"])) + local_date = "" + utc_date = "" + epoch = entry.get("epoch_published") + epoch = entry.get("epoch_updated", epoch) + if epoch: + local_date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(epoch)) + utc_date = time.strftime("%Y-%m-%d %H:%M:%SZ", time.gmtime(epoch)) end %> <td> - <time datetime="{{date}}">{{date}}</time> + <time datetime="{{utc_date}}">{{local_date}}</time> </td> <td class="td-tag"> <div> |