I am trying to set the actual date (today) as a minimum value to my date picker, using LWC. I can't make it work, as I get a component error message that "today is not defined". HTML
HTML
<template> <lightning-record-edit-form object-api-name="Reservation__c"> <lightning-messages> </lightning-messages> <lightning-input-field field-name="Date__c" type="date" name="Reservation__c" label="Date field" min={today} max="2024-01-01"> </lightning-input-field> <lightning-button class="slds-m-top_small" type="submit" label="Create new"> </lightning-button> </lightning-record-edit-form> </template> In the JS file:
@track today; connectedCallback(){ this.today = new Date(); let yyyyMmDd = today.toISOString().slice(0,10); } I don' know actually what to or how to set the today and use it as the min value (if it is possible).