unclassified dates

This commit is contained in:
jpt 2025-04-13 12:25:25 -05:00
parent 83ae35006b
commit be682f4754
3 changed files with 14 additions and 4 deletions

10
src/tt/constants.py Normal file
View File

@ -0,0 +1,10 @@
SPECIAL_DATES_PIECES = {
"future": (3000,1,1),
"unclassified": (1999,1,1),
}
SPECIAL_DATES_DISPLAY = {
"3000-01-01": "[#333333]future[/]",
"1999-01-01": "[#cccccc]unclassified[/]",
}

View File

@ -4,7 +4,7 @@ from peewee import fn
from peewee import Case, Value from peewee import Case, Value
from ..db import db, Task, SavedSearch from ..db import db, Task, SavedSearch
from .. import config from .. import config
from ..constants import SPECIAL_DATES_PIECES
def get_task(item_id: int) -> Task: def get_task(item_id: int) -> Task:
@ -14,7 +14,7 @@ def get_task(item_id: int) -> Task:
def add_task( def add_task(
text: str, text: str,
status: str, status: str,
due: datetime | None = None, due: datetime | str = SPECIAL_DATES_PIECES["unclassified"],
type: str = "", type: str = "",
project: str = "", project: str = "",
) -> Task: ) -> Task:

View File

@ -161,10 +161,10 @@ class DateModal(ModalScreen):
(p)ast (t)oday (f)uture""", classes="hints") (p)ast (t)oday (f)uture""", classes="hints")
def action_future(self): def action_future(self):
self.pieces = SPECIAL_DAYS_PIECES["future"] self.pieces = SPECIAL_DATES_PIECES["future"]
def action_unclassified(self): def action_unclassified(self):
self.pieces = SPECIAL_DAYS_PIECES["unclassified"] self.pieces = SPECIAL_DATES_PIECES["unclassified"]
def action_today(self): def action_today(self):
today = datetime.date.today() today = datetime.date.today()