Skip to content

Fix timezone handling in date-based task filterin#41

Open
uncazzy wants to merge 1 commit into
jacepark12:mainfrom
uncazzy:fix/timezone-handling
Open

Fix timezone handling in date-based task filterin#41
uncazzy wants to merge 1 commit into
jacepark12:mainfrom
uncazzy:fix/timezone-handling

Conversation

@uncazzy

@uncazzy uncazzy commented Dec 2, 2025

Copy link
Copy Markdown

Problem

Date-based task filtering functions (get_tasks_due_today, get_overdue_tasks, etc.) compare task due dates against UTC midnight boundaries. This causes tasks scheduled later in the day to be excluded from "due today" results if their UTC timestamp falls on a different calendar day.

Example: A task scheduled for 6:00 PM Eastern on December 2nd is stored as 2025-12-03T00:30:00Z in UTC. When checking "tasks due today" on December 2nd, the function would exclude this task because its UTC date is December 3rd.

Solution

  • Add timezone parameter to all date-based functions (defaults to America/New_York)
  • Calculate proper day boundaries by converting local start/end of day to UTC
  • Add tzdata dependency for cross-platform timezone support (required on Windows)

Affected Functions

  • get_tasks_due_today()
  • get_tasks_due_tomorrow()
  • get_tasks_due_in_days()
  • get_overdue_tasks()
  • get_tasks_due_this_week()
  • get_engaged_tasks()
  • get_next_tasks()

Usage

Works out of the box with Eastern Time default:

get_tasks_due_today()

Or specify a different timezone:

get_tasks_due_today(timezone="Europe/London")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant