Quantcast
Channel: jQuery Library for SharePoint Web Services
Viewing all articles
Browse latest Browse all 6517

Created Unassigned: Issue with Date localization in $().SPServices.SPGetListItemsJson [10259]

$
0
0
Hi Marc,
Fantastic work on $().SPServices.SPGetListItemsJson
However I noticed dates are returned incorrectly.

Looking at the List.asmx response my field value is returned as UTC: ows_StartAllocation='2014-05-05T21:00:00Z'

In the json result as: “Mon May 5 21:00:00 UTC+1000 2014”

But should be: “Tue May 6 07:00:00 UTC+1000 2014”

Looking at dateToJsonObject function getting the Date.UTC() first seems to resolve this for us.

```
function dateToJsonObject(s) {

var dt = s.split("T")[0] !== s ? s.split("T") : s.split(" ");
var d = dt[0].split("-");
var t = dt[1].split(":");
var t3 = t[2].split("Z");
var date = new Date(Date.UTC(d[0], (d[1] - 1), d[2], t[0], t[1], t3[0]));
return date;
}

```

Viewing all articles
Browse latest Browse all 6517

Trending Articles



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