Hi there, im attempting to add a form to post leads to SuiteCRM but i cant seem to get datetime to go over no matter what i try. I found something relating to SugarCRM where they say it needs to be posted in this format
2020-10-19T21:21:00-04:00
but no matter what i do the datetime field is always empty on creation.
here’s my code
` $('#submitButton').on('click',function(){
d = new Date($('#event_date').val())
console.log(d)
var eventDateField = document.getElementById("event_date_c");
nD = d.toISOString().toString();
eventDateField.value = nD.replace(".000Z", "-04:00")
var myDate = new Date(nD.replace(".000Z", "-04:00"))
console.log($('#event_date_c').val())
$.ajax({
url: "https://crm.URL.com/Api/V8/module",
type: 'POST',
dataType: "json",
contentType: 'application/json',
headers: {
'Authorization': 'Bearer TOKEN'
},
data: JSON.stringify({
data: {
type: "Leads",
attributes: {
first_name: $('#first_name').val(),
last_name: $('#last_name').val(),
phone_mobile: $('#phone_mobile').val(),
email1: $('#email1').val(),
event_date_c: myDate,
guest_count_c: $('#guest_count_c').val(),
event_type_c: $('#event_type_c').val(),
description: $('#description').val()
}
}
}),
`
Any help appreciated