I was trying to create a function that will verify if there is a valid date (YYYY-MM-DD) inside a string and then return it as a result of the function.

So far I have this:

```
function findDate(str){
   let dateReg = /^(19[7-9]\d|20[0-1][0-7])\/(0[1-9]|1[0-2])\/([0-2][1-9]|3[0-1])$/;
   let matchingDate = [];
   let strSplit = str.split(' ');

    for(let i = 0; i < strSplit.length; i++){
      if(dateReg.test(strSplit[i])){
        matchingDate.push(strSplit[i]);
      } else {
        return 'No valid date';
      }
    }

    return matchingDate;

}

findDate('I was born on 2017/12/05 ok?');
// findDate('She was born on 1960/08/31 ok?');
// findDate('He was born on 2010/15/31 ok?');

```

Any idea what am I missing? By default it skips the test part.

Thanks!