.html snippet (LWC Component)
.js snippet (LWC Component)
import { LightningElement, track } from 'lwc';
export default class DateTimePickerLightningInput extends LightningElement {
@track today;
connectedCallback(){
this.today = new Date().toLocaleString();
}
}
Outcome:
As per the above outcome, the Current Locale DateTime = 10/19/2022, 5:50:37 PM. But, if you could see that the lightning-input with type=datetime component is considering the DateTime = Oct 19, 2022, 9:50:37 AM and thus the validation message is dependent on the DateTime Value = Oct 19, 2022, 9:50:37 AM.
Is there any way for the lightning-input component to consider the Current Locale DateTime = 10/19/2022, 5:50:37 PM based on the User Location / Region Timezone?
Thanks in Advance !!!
Outcome using Date().toISOString() as below: