06-04-2013 06:40 AM
// check dates can be parsed i get succefully my dates in a format : 2013-07-14T00:00:00.000+01:00
str_expiryDate = field.form.prop_wfbxTestWorkFlow_NfDate.value;
console.log("Non conformite"+str_expiryDate);
str_reminderDate = field.form.prop_bpm_workflowDueDate.value;
console.log("echeance"+str_reminderDate);
Alfresco.logger.warn("Expiry Date: " + str_expiryDate + " | Reminder Date: " + str_reminderDate);
//parsing date to compare the two dates i get null with utils.fromIso.. and get the some with parse function
var origDate = utils.fromISO8601(str_expiryDate);
console.log("nouvelle conversion"+origDate);
d_expiryDate = Date.parse(str_expiryDate);
console.log("nfDate"+d_expiryDate);
d_reminderDate = Date.parse(str_reminderDate);
console.log("Date echéance"+d_reminderDate);
Components.utils.import("resource://gre/modules/ISO8601DateUtils.jsm");Uncaught ReferenceError: Components is not defined
06-04-2013 09:32 AM
2013-06-13T00:00:00.000+01:00
06-04-2013 10:22 AM
2011-11-28T17:06:51.477Z
to be successfully converted06-04-2013 11:29 AM
var origDate = utils.fromISO8601(str_expiryDate); console.log("nouvelle conversion"+origDate);
06-04-2013 11:45 AM
function dateFromISO8601(isostr) {
var parts = isostr.match(/\d+/g);
return new Date(parts[0], parts[1] - 1, parts[2], parts[3], parts[4], parts[5]);
}
d_expiryDate = dateFromISO8601(str_expiryDate);
console.log("nfDate"+d_expiryDate);
d_reminderDate = dateFromISO8601(str_reminderDate);
console.log("Date echéance"+d_reminderDate);
nfDateSat Jun 29 2013 00:00:00 GMT+0100 (Afr. centrale Ouest) formValidation-min.js:51
Date echéanceWed Jun 05 2013 00:00:00 GMT+0100 (Afr. centrale Ouest)
06-04-2013 02:24 PM
util
is part of Alfresco's Javascript API, so it's not available on the client side. On the client you can just include something like date.js and have it handle dates for you, or write a custom method like you did.
06-05-2013 06:02 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.