Skip to content

Updated _parse_due_date to handle accepting a JSON dictionary object#1

Open
jshiflet wants to merge 1 commit into
cromulus:mainfrom
jshiflet:jshiflet/due-date-parsing-fix
Open

Updated _parse_due_date to handle accepting a JSON dictionary object#1
jshiflet wants to merge 1 commit into
cromulus:mainfrom
jshiflet:jshiflet/due-date-parsing-fix

Conversation

@jshiflet

Copy link
Copy Markdown

Whenever the HA integration tries pulling the reminders from the reminders-api, you could potentially see hundreds of error log entries like this:

2026-06-15 01:37:53.902 WARNING (MainThread) [custom_components.reminders_api.todo] Failed to parse due date: {'formatted': 'Jun 3, 2026 at 12:00\u202fPM CDT', 'iso': '2026-06-03T17:00:00Z', 'relative': 'last week', 'timezone': 'America/Chicago'}

This happens because the existing _parse_due_date function only accepted a string as value for dueDate. The reminders-api REST API returns a JSON dictionary object for the due date like this:

"dueDate" : {
      "formatted" : "Jul 1, 2026 at 4:00 PM CDT",
      "iso" : "2026-07-01T21:00:00Z",
      "relative" : "in 2 weeks",
      "timezone" : "America\/Chicago"
    },

This update allows _parse_due_date to also accept a JSON dictionary object, and will parse the iso string from the dueDate object to get the due date in a consistent format. If the dueDate value is already an ISO string, it will continue to parse it as before.

The exisitng _parse_due_date function only accepted a string as the due date.
The reminders-api REST API returns a JSON dictionary object for the due date like this:
```
"dueDate" : {
      "formatted" : "Jul 1, 2026 at 4:00 PM CDT",
      "iso" : "2026-07-01T21:00:00Z",
      "relative" : "in 2 weeks",
      "timezone" : "America\/Chicago"
    },
```
This update allows _parse_due_date to also accept a JSON dictionary object,
and will parse the "iso" field to get the due date in a consistent format.
If the dueDate value is already an ISO string, it will continue to parse it as before.

Co-authored-by: codex <codex@openai.com>
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