Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

SP Client Update to List inserts Wrong Date

$
0
0
           var context = new SP.ClientContext.get_current(); 
           var web = context.get_web(); 
           var list = web.get_lists().getByTitle("InterpreterRequests"); 
           var itemCreateInfo = new SP.ListItemCreationInformation(); 
           var listItem = list.addItem(itemCreateInfo);
           listItem.set_item('RequestDate', question1);
alert("Date 1: " + question1);
           listItem.update(); 
           context.executeQueryAsync(success,failure);

Above is the Javascript i'm using to enter a new item in the list. I skipped the code for all the other list items because the problem is the date. As you can see, I put in an alert to see what the date is just before the update, and it's correct. When it updates, any date I use inserts the wrong date into the list. To be more exact, it always inserts the day before whatever was entered.

Does anyone know what is wrong and how I can remedy this?
(I tried a function to add a day to each item before the update, and though technically it works, it won't work with Chrome)


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>