I'm trying to check if the input value either matches the date format YYYY-MM-DD or YYYY-MM-DD - YYYY-MM-DD using the following code, but it returns false on the input 2018-01-29. 
  const singleDateRegex = new RegExp('\d{4}-\d{2}-\d{2}$');
  const rangeRegex = new RegExp('\d{4}-\d{2}-\d{2} \d{4}-\d{2}-\d{2}$');
  const matchSingle = singleDateRegex.test(value); //false
  const matchRange = rangeRegex.test(value);       //false
 
    