Shrink minimum size for date widget to fit-content, add label if set

This commit is contained in:
nathan 2022-06-24 14:08:06 -06:00
parent d11be10fa1
commit 9ffc7decf2
2 changed files with 2 additions and 1 deletions

View File

@ -12,7 +12,7 @@ export const dateStyles = [
:host { :host {
display: inline-block; display: inline-block;
white-space: nowrap; white-space: nowrap;
min-width: 20ex; min-width: fit-content;
} }
.overdue { .overdue {
color: red; // var(--whatever the theme color) color: red; // var(--whatever the theme color)

View File

@ -56,6 +56,7 @@ export class Et2DateReadonly extends Et2Widget(LitElement) implements et2_IDetac
let parsed : Date | Boolean = this.value ? this.parser(this.value) : false let parsed : Date | Boolean = this.value ? this.parser(this.value) : false
return html` return html`
<span slot="label">${this.label}</span>
<time ${this.id ? html`id="${this._dom_id}"` : ''} <time ${this.id ? html`id="${this._dom_id}"` : ''}
datetime="${parsed ? this.formatter(<Date>parsed, {dateFormat: "Y-m-d", timeFormat: "H:i:s"}) : ""}"> datetime="${parsed ? this.formatter(<Date>parsed, {dateFormat: "Y-m-d", timeFormat: "H:i:s"}) : ""}">
${this.value ? this.formatter(<Date>parsed) : ''} ${this.value ? this.formatter(<Date>parsed) : ''}