A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

New answers tagged


event.target.values a string, not a date. You need to convert the value to date first then you need to subtract it. import { LightningElement, track } from 'lwc'; export default class LightningExampleInputDate extends LightningElement { @track date1; @track date2; @track result; datehandler1(event) { this.date1 = new Date(event....


Check out this playground to get an sample example of Number field with a predefined value in Lightning Web Component. value property of lightning-input component specifies the value of an input element. Reference:- Lightning Web Component Input if you are dealing with Lightning Data service and want to pre-populate the field value of lightning-input-...


According to SF documentation, it is possible to be done without placeholder, just put default value in value field: <lightning:input type="number" name="input2" label="Number field with a predefined value" value="0.0"/>

Top 50 recent answers are included