Skip to content

Commit

Permalink
v3 Support datetime time entity (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
RFDarter authored Apr 23, 2024
1 parent d60667a commit 604bb8f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
23 changes: 18 additions & 5 deletions packages/v3/src/esp-entity-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,15 +271,16 @@ class ActionRenderer {
</button>`;
}

private _date(
private _datetime(
entity: entityConfig,
type: string,
action: string,
opt: string,
value: string,
) {
return html`
<input
type="date"
type="${type}"
name="${entity.unique_id}"
id="${entity.unique_id}"
value="${value}"
Expand All @@ -294,7 +295,6 @@ class ActionRenderer {
`;
}


private _switch(entity: entityConfig) {
return html`<esp-switch
color="var(--primary-color,currentColor)"
Expand Down Expand Up @@ -444,13 +444,26 @@ class ActionRenderer {
render_date() {
if (!this.entity) return;
return html`
${this._date(
${this._datetime(
this.entity,
"date",
"set",
"value",
this.entity.value,
)}
`;
}

render_time() {
if (!this.entity) return;
return html`
${this._datetime(
this.entity,
"time",
"set",
"value",
this.entity.value,
)}
${this.entity.uom}
`;
}

Expand Down
1 change: 1 addition & 0 deletions packages/v3/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export default defineConfig({
"/events": proxy_target,
"/text": proxy_target,
"/date": proxy_target,
"/time": proxy_target,
},
},
});

0 comments on commit 604bb8f

Please sign in to comment.