Skip to main content
added 7 characters in body
Source Link

When I select the time first in the date time field it does not hold the value and when I do the same again and select the time first it holds it. Below is my code :

JS :

@api endDateTime;endDateTime = null;
handleEndChange (event) {
    this.endDateTime = event.detail.value;       
} 
           

html :

<lightning-input class="" type="datetime" name="End" label="End" value={endDateTime} onchange={handleEndChange} message-when-value-missing=" " message-when-bad-input=" " required></lightning-input>

enter image description here

enter image description here

When I select the time first in the date time field it does not hold the value and when I do the same again and select the time first it holds it. Below is my code :

JS :

@api endDateTime;
handleEndChange (event) {
    this.endDateTime = event.detail.value;       
} 
           

html :

<lightning-input class="" type="datetime" name="End" label="End" value={endDateTime} onchange={handleEndChange} message-when-value-missing=" " message-when-bad-input=" " required></lightning-input>

enter image description here

enter image description here

When I select the time first in the date time field it does not hold the value and when I do the same again and select the time first it holds it. Below is my code :

JS :

@api endDateTime = null;
handleEndChange (event) {
    this.endDateTime = event.detail.value;       
} 
           

html :

<lightning-input class="" type="datetime" name="End" label="End" value={endDateTime} onchange={handleEndChange} message-when-value-missing=" " message-when-bad-input=" " required></lightning-input>

enter image description here

enter image description here

added 23 characters in body
Source Link

When I select the time first in the date time field it does not hold the value and when I do the same again and select the time first it holds it. Below is my code :

JS :

@api endDateTime;
handleEndChange (event) {
    this.endDateTime = event.detail.value;       
} 
           

html :

<lightning-input class="" type="datetime" name="End" label="End" value={endDateTime} onchange={handleEndChange} message-when-value-missing=" " message-when-bad-input=" " required></lightning-input>

enter image description here

enter image description here

When I select the time first in the date time field it does not hold the value and when I do the same again and select the time first it holds it. Below is my code :

JS :

handleEndChange (event) {
    this.endDateTime = event.detail.value;       
} 
           

html :

<lightning-input class="" type="datetime" name="End" label="End" value={endDateTime} onchange={handleEndChange} message-when-value-missing=" " message-when-bad-input=" " required></lightning-input>

enter image description here

enter image description here

When I select the time first in the date time field it does not hold the value and when I do the same again and select the time first it holds it. Below is my code :

JS :

@api endDateTime;
handleEndChange (event) {
    this.endDateTime = event.detail.value;       
} 
           

html :

<lightning-input class="" type="datetime" name="End" label="End" value={endDateTime} onchange={handleEndChange} message-when-value-missing=" " message-when-bad-input=" " required></lightning-input>

enter image description here

enter image description here

Source Link

lightning-input type="datetime" does not hold the time value at first time in the UI

When I select the time first in the date time field it does not hold the value and when I do the same again and select the time first it holds it. Below is my code :

JS :

handleEndChange (event) {
    this.endDateTime = event.detail.value;       
} 
           

html :

<lightning-input class="" type="datetime" name="End" label="End" value={endDateTime} onchange={handleEndChange} message-when-value-missing=" " message-when-bad-input=" " required></lightning-input>

enter image description here

enter image description here