Working with JSON Dates

Currently there is no standardized syntax for JSON serliazed date objects. The JavaScript Checkout API uses a few date objects within the API (primary the shipOnDate and deliveryDate fields on the Cart object). When are you working with these fields they actually come down from the XHR response as strings. You will need to use the provided helper methods to transform the strings to JavaScript native Date objects and vice versa. The syntax of these two helper methods in the checkoutapi.js is:
function ucJsonStringToDate(String s ) => Date;function ucDateToJsonString(Date d) => String;
Below is an example of how to retrieve the shipOnDate, do something with it, and then update the cart objects:
var d = ucJsonStringToDate(cart.shipOnDate);// Do some manipulation of the date here. cart.shipOnDate = ucDateToJsonString(d);
Remember that shipOnDate and deliveryDate can both be null. The JavaScript helper methods will properly interpret nulls.