Trying to update the following fields,Date field is not updating in updateRecord
.( Other Fields got updated with correct value).
When i console.log the new Date()
it print as below.
Sat Apr 04 2020 19:14:07 GMT+0530 (India Standard Time)
import PAYMENT_DATE from "@salesforce/schema/SCInvoice__c.Payment_Date__c";
import INVOICE_ID from "@salesforce/schema/SCInvoice__c.Id";
import STAGE from "@salesforce/schema/SCInvoice__c.Stage__c";
import { updateRecord } from "lightning/uiRecordApi";
handlePayByCash() {
var d = new Date();
fields[INVOICE_ID.fieldApiName] = this.invoiceRecordId;
fields[PAYMENT_DATE.fieldApiName] = d;
fields[STAGE.fieldApiName] = "Payment Received";
updateRecord(recordInput)
.then(() => {
this.variant = "success";
this.title = "Success";
this.message = "Payment Received!";
})
.catch(error => {
});
}
YYYY-MM-DD
format, not the Javascript date string. You can use theIntl.DateTimeFormat
to format the date or toISOString if it is a date time.