AnsweredAssumed Answered

Parsing date javascript alfresco

Question asked by aitbenmouh on Jun 4, 2013
Latest reply on Jun 5, 2013 by ddraper

Im developping a custom validator of a date input in my workflow form and i get null after parsing a date this is what i done:

// 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;

      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);

      d_reminderDate = Date.parse(str_reminderDate);
      console.log("Date echéance"+d_reminderDate);

Waiting your help thanks.

I found in mozilla api that i have to include the module where functions are defined so i want to include this module how i can do it because when i put this
Components.utils.import("resource://gre/modules/ISO8601DateUtils.jsm");Uncaught ReferenceError: Components is not defined

I get the error above my js script is in /share/js/script.js can someone help where we do import of javascript modules ?