Handle partial dates in custom rules

Oracle Clinical One Platform handles dates differently depending on whether they are partial dates or not.

While writing a rule definition in the Rule editor you can retrieve the value of a date item into a variable. If the date is a full date, a standard JavaScript Date object is created to hold the variable. In the case for partial dates or time elements only, a custom object C1Date (defined only for Oracle Clinical One Platform) is created.

When it comes to using date variables with date and time helper functions, you must know that there are different types of helper functions and not all of them take partial dates. Only when a rule helper function is pure JavaScript, both rule variables and locally defined variables (either as Date or C1Date objects) can be used. The available pure JavaScript rule helper functions are: Other functions only take full JavaScript Date objects, meaning partial dates are not supported. You may refer to the whole list of available helper functions and their documentation in the Rules helper function reference section.

Usage tips

  • Check your variable type to avoid rule failure. To know how your variable is created and which type of object it is, you can use the logMsg(). See Debug a rule.
  • You can use the associated methods of each object type to gather specific elements of any date. This way you can manually evaluate and compare dates that may not be supported by existing rule helper functions.

Review more information on the available date objects: