I am currently developing a SharePoint 2013 app and I have ran into an issue.

I have REST api that runs when the user tries to submit data, I have managed to get the Title field to submit the SharePoint list but I cannot get the Date Input value to submit to the list. The list is situated in the Host Web and the rest of the code does appear to work.

I am seeing a '400 (bad request)' in the console when submitting.

I currently have the following code:

function Submit() {
$('#submitBtn').click(function () {
    var listName = "MyList";
    var itemType = "SP.List";

    var item = {
        "__metadata": { "type": itemType },
        "Title": $('#TitleInput').val(),
        "Date": $('#DateInput').val()

    var url = appweburl + "/_api/SP.AppContextSite(@target)" +
        "/web/lists/getbytitle('" + listName + "')/items?" +
        "@target='" + hostweburl + "'";

    var bodyItem = JSON.stringify(item);

        url: url,
        type: "POST",
        contentType: "application/json;odata=verbose",
        data: JSON.stringify(item),
        headers: {
            "Accept": "application/json;odata=verbose",
            "X-RequestDigest": $("#__REQUESTDIGEST").val()
        success: function (data) {
            console.log("Item created in host web");
        error: function (data) {
            console.log("Failed to add item to host web");


Any help would be greatly appreciated, I have had a Google on how to do this but so far turned up no reliable results.



1 Answer 1


You can use ISO 8601 format (YYYY-MM-DD) for dates. The following will work:

  • 2015-08-11
  • 2015-08-11T12:40:16Z

If you are in chrome, using a date input (<input type="date" />), then it will always return it in ISO 8601 format. If not, and you're using a JavaScript library to create a datepicker control, then check if they have a format options. Otherwise use JavaScript to format the date as needed. If you have a Date object, then calling Date.toJSON() will format the date correctly.

  • I currently have an input like this: <input type="date" name="Date" id="expensesDateInput" required/> I am also using Chrome however it does not seem to be submitting to the SharePoint list that we have, the title submits just fine but not the date.
    – Adam13Hylo
    Commented Aug 17, 2015 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.