forked from extern/egroupware
Et2Date fixes
- Fix mobile get / set value was not actually setting value properly - Set a minimum input width
This commit is contained in:
parent
ae01e30d55
commit
206652307b
@ -325,18 +325,22 @@ export class Et2Date extends Et2InputWidget(FormControlMixin(LitFlatpickr))
|
||||
:host {
|
||||
width: auto;
|
||||
}
|
||||
::slotted([slot='input'])
|
||||
{
|
||||
|
||||
::slotted([slot='input']) {
|
||||
flex: 1 1 auto;
|
||||
min-width: 12ex;
|
||||
}
|
||||
|
||||
/* Scroll buttons */
|
||||
|
||||
.input-group__container {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.input-group__container:hover .et2-date-time__scrollbuttons {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.et2-date-time__scrollbuttons {
|
||||
display: none;
|
||||
flex-direction: column;
|
||||
@ -344,6 +348,7 @@ export class Et2Date extends Et2InputWidget(FormControlMixin(LitFlatpickr))
|
||||
position: absolute;
|
||||
right: 0px;
|
||||
}
|
||||
|
||||
.et2-date-time__scrollbuttons > * {
|
||||
font-size: var(--sl-font-size-2x-small);
|
||||
height: calc(var(--sl-input-height-medium) / 2);
|
||||
@ -621,16 +626,23 @@ export class Et2Date extends Et2InputWidget(FormControlMixin(LitFlatpickr))
|
||||
{
|
||||
date = new Date(value);
|
||||
}
|
||||
// Handle timezone offset, flatpickr uses local time
|
||||
let formatDate = new Date(date.valueOf() + date.getTimezoneOffset() * 60 * 1000);
|
||||
if(typeof egwIsMobile == "function" && egwIsMobile())
|
||||
{
|
||||
if(this._inputNode)
|
||||
{
|
||||
this._inputNode.value = isNaN(date) ? "" : this.format(date, {dateFormat: 'Y-m-dTH:i'});
|
||||
}
|
||||
else
|
||||
{
|
||||
this.updateComplete.then(() =>
|
||||
{
|
||||
this._inputNode.value = this.format(formatDate, {dateFormat: 'Y-m-d'});
|
||||
this._inputNode.value = isNaN(date) ? "" : this.format(date, {dateFormat: 'Y-m-dTH:i'});
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
// Handle timezone offset, flatpickr uses local time
|
||||
let formatDate = new Date(date.valueOf() + date.getTimezoneOffset() * 60 * 1000);
|
||||
if(!this._instance)
|
||||
{
|
||||
this.defaultDate = formatDate;
|
||||
@ -651,7 +663,7 @@ export class Et2Date extends Et2InputWidget(FormControlMixin(LitFlatpickr))
|
||||
{
|
||||
return flatpickr.formatDate(<Date>this.defaultDate, this.getOptions().dateFormat);
|
||||
}
|
||||
return this._inputNode?.value || '';
|
||||
return this._inputNode?.value + "Z" || '';
|
||||
}
|
||||
let value = this._inputElement.value;
|
||||
|
||||
|
@ -24,6 +24,12 @@ export class Et2DateTime extends Et2Date
|
||||
:host([focused]) ::slotted(button), :host(:hover) ::slotted(button) {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
::slotted([slot='input']) {
|
||||
flex: 1 1 auto;
|
||||
min-width: 17ex;
|
||||
}
|
||||
|
||||
::slotted(.calendar_button) {
|
||||
border: none;
|
||||
background: transparent;
|
||||
|
Loading…
Reference in New Issue
Block a user