I want to set the status of a task as due today, due tomorrow, overdue or upcoming if the date that the task is due on is today, yesterday (or before that) or tomorrow (or after tomorrow)
This is what I do to compare today :
if (timezone.now().date == k["due_on"].date) :
task.status = "due today"
I want to write similar logics for future or past something like this:
if (k["due_on"].date == tomorrow) :
task.status = "due tomorrow"
and so on.
Please help
from datetime import timedelta
tomorrow = timezone.now() + timedelta(days=1)
if (k["due_on"].date == tomorrow.date()) :
task.status = "due tomorrow"
you can use this to check next days date