diff --git a/dooit/ui/widgets/inputs.py b/dooit/ui/widgets/inputs.py index 7b36b2c1..9e5f81ea 100644 --- a/dooit/ui/widgets/inputs.py +++ b/dooit/ui/widgets/inputs.py @@ -10,11 +10,14 @@ TODOS = config_man.get("TODO") WORKSPACES = config_man.get("WORKSPACE") + RED = config_man.get("red") YELLOW = config_man.get("yellow") GREEN = config_man.get("green") ORANGE = config_man.get("orange") +DATE_FORMAT = config_man.get("DATE_FORMAT") + DATE_MAX_WIDTH = 17 @@ -102,12 +105,19 @@ def draw(self) -> str: icon = TODOS["due_icon"] style = getattr(self.screen, "date_style") + due: datetime = getattr(self.model, f"_{self._property}")._value + if style == "classic": - value = super().draw() - if not value or value == "none": + if not due: return "" + + time = due.time() + if time.hour == time.minute == 0: + return due.strftime(DATE_FORMAT) + else: + return due.strftime(f"{DATE_FORMAT} %H:%M") + else: - due: datetime = getattr(self.model, f"_{self._property}")._value if not due: return "" diff --git a/dooit/utils/default_config.py b/dooit/utils/default_config.py index 460b1eb7..c2c705ca 100644 --- a/dooit/utils/default_config.py +++ b/dooit/utils/default_config.py @@ -69,6 +69,7 @@ def get_username(): YANK_COLOR = blue SAVE_ON_ESCAPE = False USE_DAY_FIRST = True +DATE_FORMAT = "%d %h" ################################# # DASHBOARD #