How to use the cql-execution.DateTime function in cql-execution

To help you get started, we’ve selected a few cql-execution examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AHRQ-CDS / AHRQ-CDS-Connect-Authoring-Tool / frontend / src / actions / artifacts.js View on Github external
params.forEach((p) => {
    // Handle the null case first so we don't have to guard against it later
    if (p.value == null) {
      paramsObj[p.name] = null;
      return;
    }
    switch (p.type) {
      case 'boolean':
        paramsObj[p.name] = p.value === 'true';
        break;
      case 'datetime':
        paramsObj[p.name] = cql.DateTime.parse(p.value.str.slice(1));
        break;
      case 'decimal':
        paramsObj[p.name] = p.value.decimal;
        break;
      case 'integer':
        paramsObj[p.name] = p.value;
        break;
      case 'interval_of_datetime': {
        let d1 = null;
        let d2 = null;
        if (p.value.firstDate) {
          const str = p.value.firstTime ? `${p.value.firstDate}T${p.value.firstTime}` : p.value.firstDate;
          d1 = cql.DateTime.parse(str);
        }
        if (p.value.secondDate) {
          const str = p.value.secondTime ? `${p.value.secondDate}T${p.value.secondTime}` : p.value.secondDate;