You need to sign in to do that
Don't have an account?
Sue Irvine 16
lwc date format in recordeditform
Hello - I have a LWC with a RecordEditForm and want to set the value of a custom field to today's date upon submit, but can't get the right formatting in the Javascript submit handler. Everything I've tried gives me an invalid date format error. Can someone clue me in on the right format to use? Thanks!
handlesubmit(event){ event.preventDefault(); console.log('handle submit'); const fields = event.detail.fields; fields.Travel_Dates_Sent_to_PS__c = false; if (this.updatetype=="cancel"){ let dt = Date.now(); fields.Travel_End_Date__c=dt; } this.template.querySelector('lightning-record-edit-form').submit(fields); }
Please use the below code to acheiev this:
Use the seperate JS method to get the date in YYYY-MM-DD format then you can save the date in custom field.
Thanks,
Maharajan.C
All Answers
Please use the below code to acheiev this:
Use the seperate JS method to get the date in YYYY-MM-DD format then you can save the date in custom field.
Thanks,
Maharajan.C
Tell Pizza Hut Survey (https://papasurvey.info/tellpizzahut-com-tell-pizza-hut-survey/)
Can you please mark the best answer to close this thread ...
Thanks,
Maharajan.C