From 9a998d185d8c5223b3fd8df14a3eb3d4d3d79f4a Mon Sep 17 00:00:00 2001 From: xBelladonna Date: Sat, 18 Jan 2020 18:00:53 +0930 Subject: [PATCH] Enable custom date format in config Signed-off-by: xBelladonna --- clock.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/clock.py b/clock.py index a0828f6..9914d19 100644 --- a/clock.py +++ b/clock.py @@ -15,6 +15,11 @@ class PwnClock(plugins.Plugin): __description__ = 'Clock/Calendar for pwnagotchi' def on_loaded(self): + if 'date_format' in self.options: + self.date_format = self.options['date_format'] + else: + self.date_format = "%m/%d/%y" + logging.info("Pwnagotchi Clock Plugin loaded.") def on_ui_setup(self, ui): @@ -36,5 +41,5 @@ class PwnClock(plugins.Plugin): def on_ui_update(self, ui): now = datetime.datetime.now() - time_rn = now.strftime("%m/%d/%y\n%I:%M%p") + time_rn = now.strftime(self.date_format + "\n%I:%M %p") ui.set('clock', time_rn)