aboutsummaryrefslogtreecommitdiff
path: root/ihatemoney/history.py
diff options
context:
space:
mode:
authorBaptiste Jonglez <git@bitsofnetworks.org>2020-04-26 16:40:35 +0200
committerGlandos <bugs-github@antipoul.fr>2020-11-13 21:40:39 +0100
commit914482bc76954aef067ac73314a19f415a32c61c (patch)
tree794976253205ceedcbb90417e2e5a06b01f1a629 /ihatemoney/history.py
parentde13945a914b648c2ae6ad9ef0795e83f4c357a9 (diff)
downloadihatemoney-mirror-914482bc76954aef067ac73314a19f415a32c61c.zip
ihatemoney-mirror-914482bc76954aef067ac73314a19f415a32c61c.tar.gz
ihatemoney-mirror-914482bc76954aef067ac73314a19f415a32c61c.tar.bz2
Use Flask-Babel to localize datetime in the History Page
By formatting datetime on the server, we get nice localized datetime strings that are adapted to the currently-selected language. Example: - English: "Apr 26, 2020, 3:58:54 PM" - French: "26 avr. 2020 à 15:58:54" - German: "26.04.2020, 15:58:54" - Spanish: "26 abr. 2020 15:58:54" - Indonesian: "26 Apr 2020 15.58.54" - Chinese: "2020年4月26日 下午3:58:54" However, there is a downside: time is not adapted to the user timezone. The solution is to define a timezone on the server: we use the server OS timezone by default, and it can be customized through the BABEL_DEFAULT_TIMEZONE setting. It's still not ideal, because it assumes that all users are in the same timezone (the one configured on the server).
Diffstat (limited to 'ihatemoney/history.py')
-rw-r--r--ihatemoney/history.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/ihatemoney/history.py b/ihatemoney/history.py
index 801e39e..3f99420 100644
--- a/ihatemoney/history.py
+++ b/ihatemoney/history.py
@@ -82,7 +82,7 @@ def get_history(project, human_readable_names=True):
object_str = describe_version(version)
common_properties = {
- "time": version.transaction.issued_at.strftime("%Y-%m-%dT%H:%M:%SZ"),
+ "time": version.transaction.issued_at,
"operation_type": version.operation_type,
"object_type": object_type,
"object_desc": object_str,