Skip to content

Minor UI bugfixes for selector-datetime and dialog-date-picker #15759

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

Merged
merged 4 commits into from
May 31, 2023

Conversation

karwosts
Copy link
Contributor

@karwosts karwosts commented Mar 7, 2023

Proposed change

A few miscellaneous bugfixes:

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

Additional information

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

const y = today.getFullYear();
const m = (today.getMonth() + 1 < 10 ? "0" : "") + (today.getMonth() + 1);
const d = (today.getDate() < 10 ? "0" : "") + today.getDate();
this._value = y + "-" + m + "-" + d;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I contemplated putting this in format_date, but I couldn't think of a good name to give it, and didn't see it used elsewhere. I would have hoped there would be an easier standard way to get this format, but I couldn't find one.

@value-changed=${this._valueChanged}
>
</ha-date-input>
<ha-time-input
enable-second
.value=${values?.[1] || "0:00:00"}
.value=${values?.[1] || "00:00:00"}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If pass "0:00:00" to time-input, it reformats it as "00:00:00" and fires an unwanted value-changed event.

@@ -72,7 +72,7 @@ export class HaDateTimeSelector extends LitElement {

private _sendChangedEvent(): void {
fireEvent(this, "value-changed", {
value: `${this._dateInput.value} ${this._timeInput.value}`,
value: `${this._dateInput.value ?? ""} ${this._timeInput.value}`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we not just only send a change event when we can send a valid value? So when we have both a date and time?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we can do that. Updated.

@bramkragten bramkragten enabled auto-merge (squash) May 31, 2023 12:15
@bramkragten bramkragten merged commit aea668e into home-assistant:dev May 31, 2023
@karwosts karwosts deleted the ui-date-bugfixes branch June 26, 2023 13:42
@github-actions github-actions bot locked and limited conversation to collaborators Jun 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ha-selector-datetime broken in ha-service-control
2 participants