From 512c0896c0c74215bbe15abe5db8c1d75373fdc1 Mon Sep 17 00:00:00 2001 From: LucasVbr Date: Mon, 6 Jun 2022 12:59:35 +0200 Subject: [PATCH] Edit TimeZone to "Europe/Paris" --- config.json | 1 + main.py | 6 +++++- requirements.txt | 3 ++- templates/index.md.jinja | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/config.json b/config.json index a670855..56b1479 100644 --- a/config.json +++ b/config.json @@ -2,6 +2,7 @@ "info": { "name": "Lucàs", "city": "Rodez", + "timezone": "Europe/Paris", "hi_img": { "src": "./img/Hi.gif", "alt": "Wave hand", diff --git a/main.py b/main.py index af19ec7..eca5993 100644 --- a/main.py +++ b/main.py @@ -6,6 +6,7 @@ __version__ = "3.0.0" from Utils import * from src.FileUtils import getJsonData from datetime import datetime +import pytz CONFIG_FILE = "config.json" @@ -16,7 +17,10 @@ if __name__ == "__main__": data["info"] = configData.get("info") data["tools"] = convertToolBadges(data.get("tools")) data["weather"] = getWeather(data.get("info").get('city')) - data['today'] = datetime.today().strftime("%A %d %B %y, %H:%M") + data['today'] = datetime \ + .today() \ + .astimezone(pytz.timezone(data['info'].get('timezone'))) \ + .strftime("%A %d %B %y, %H:%M") buildFile( configData.get("template_file"), diff --git a/requirements.txt b/requirements.txt index 3fbec87..4719b38 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ flask~=2.1.2 colour~=0.1.5 simpleicons~=6.23.0 -meteofrance-api~=1.0.2 \ No newline at end of file +meteofrance-api~=1.0.2 +pytz~=2021.3 \ No newline at end of file diff --git a/templates/index.md.jinja b/templates/index.md.jinja index da56f89..fcbffd0 100644 --- a/templates/index.md.jinja +++ b/templates/index.md.jinja @@ -19,7 +19,7 @@ I'm {{ data.info.name }}, a passionate developer from {{ imageWithSize(data.info
This README is generated every 3 hours.
-Last refresh: **{{ data.today }}**
+Last refresh: **{{ data.today }}** ({{ data.info.timezone }})
{% for img in data.footer_badges -%} {{ image(img) }} {% endfor %}