New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggest an ISO 8601 sample in datetime.set_value #101609
Suggest an ISO 8601 sample in datetime.set_value #101609
Conversation
The example datetime value proposed in the developer tools for the datetime.set_value is currently not correct. It does not comply with any of the formats supported by [`parse_datetime()`](https://github.com/home-assistant/core/blob/55bf309d2f9b5bde2025fbae9f0d101b8755893b/homeassistant/util/dt.py#L183) in `homeassistant/util/dt.py` The problem is the slashes in the date which must be replaced by hyphens. But this function does its first parsing attempt against the ISO 8601 format. The regex looks like a fallback approach to me. And I figured proposing a value complying with the ISO standard is the best we can do to educate users as to how to use the datetime.set_value service.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Please don't touch the branch after approval unless requested. Thanks! |
Sorry, my bad. I was confused regarding the next steps and I hit the update branch button by mistake. |
Just curious: how do you guarantee not to break the dev branch if you support merging branches that are not up to date? I understand this would be very difficult to enforce given the amount of new PRs, but I'm interested to learn more from your experience in that domain. |
We don't. That simple :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @2franix 👍
../Frenck
Proposed change
The example datetime value proposed in the developer tools for the datetime.set_value is currently not correct. It does not comply with any of the formats supported by
parse_datetime()
inhomeassistant/util/dt.py
The obvious problem is the slashes in the date which must be replaced by hyphens. So we could just use
2022-11-01 22:15
and that would work.But
parse_datetime()
does its first parsing attempt against the ISO 8601 format and the regex looks like a fallback approach to me. Because of that, I figured proposing a value complying with the ISO standard is the best we can do to educate users as to how to use the datetime.set_value service.Type of change
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.To help with the load of incoming pull requests: