I'm relatively new to Notion and I'm currently working on setting up a database to track my tasks. I attempted to use formulas within Notion, but I find them a bit confusing. To simplify things, I decided to draft a Python script that captures the logic I want to implement. Now, I'm seeking assistance to translate this Python code into a Notion formula.
import datetime
time_now = datetime.datetime.now()
statuses = ["Not Started", "In Progress", "Completed"]
my_status = "Not Started"
due_date = "12/08/2023"
due_date_obj = datetime.datetime.strptime(due_date, "%d/%m/%Y")
time_difference = due_date_obj - time_now
days_difference = time_difference.days
message = f"Due date is on {due_date_obj.date()}"
if days_difference > 1:
message = f"There are {days_difference} days left until the due date."
elif days_difference == 1 and my_status != "Completed":
message = "Due Tomorrow ⌛"
elif days_difference == 0:
if my_status == "Completed":
message = f"Due Today (Task Completed)"
else:
message = "Due Today "
elif days_difference == -1 and my_status != "Completed":
message = "Due Date was yesterday⚠️"
elif days_difference < -1 and my_status != "Completed":
message = f"Due Date was {abs(days_difference)} days ago⚠️"
print(message)