• Tofing ali Tofing ali
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
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);
    }