code: function validateAndExtract(input) {
  
      var results = recognizeDate(input);
  
      // Check there are valid results
      if (results.length && results[0].typeName.startsWith('datetimeV2')) {
          // The DateTime model can return several resolution types (https://github.com/Microsoft/Recognizers-Text/blob/master/JavaScript/recognizers-date-time/src/dateTime/constants.ts#L2-L9)
          // We only care for those with a date, date and time, or date time period:
          // date, daterange, datetime, datetimerange
  
          var first = results[0];
          var subType = first.typeName.split('.')[1];
          var resolutionValues = first.resolution && first.resolution.values;
  
          if (!resolutionValues) {
              // no resolution values
              return {
                  valid: false
              }
          }
  
          if (subType.includes('date') && !subType.includes('range')) {
              // a date (or date & time) or multiple
              var moments = resolutionValues.map(m => new Date(m.value));
              var moment = moments.find(isFuture) || moments[0];              // Look for the first future moment; default to first resolution
              if (isFuture(moment)) {
                  // a future moment, valid!
                  return {
                      valid: true,
                      value: moment
                  };
              }
  
              // a past moment
              return {
                  valid: false,
                  error: 'past_value',
                  value: moment,
              }
          } else if (subType.includes('date') && subType.includes('range')) {
              // range
              var from = new Date(resolutionValues[0].start);
              var to = new Date(resolutionValues[0].end);
              if (!isNaN(from.getTime()) && !isNaN(to.getTime())) {
                  if (isFuture(from) && isFuture(to)) {
                      // future
                      return {
                          valid: true,
                          value: [from, to]
                      };
                  }
  
                  // past
                  return {
                      valid: false,
                      error: 'past_value',
                      value: [from, to]
                  };
              }
          }
      }
  
      return {
          valid: false
      };
  }
docs: Date Helpers