Updated _parse_due_date to handle accepting a JSON dictionary object#1
Open
jshiflet wants to merge 1 commit into
Open
Updated _parse_due_date to handle accepting a JSON dictionary object#1jshiflet wants to merge 1 commit into
jshiflet wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Whenever the HA integration tries pulling the reminders from the reminders-api, you could potentially see hundreds of error log entries like this:
This happens because the existing
_parse_due_datefunction only accepted a string as value fordueDate. The reminders-api REST API returns a JSON dictionary object for the due date like this:This update allows
_parse_due_dateto also accept a JSON dictionary object, and will parse theisostring from thedueDateobject to get the due date in a consistent format. If thedueDatevalue is already an ISO string, it will continue to parse it as before.