(str)
| 36 | } |
| 37 | |
| 38 | export function parse(str) { |
| 39 | let result; |
| 40 | let errors = []; |
| 41 | try { |
| 42 | result = parseDate(str); |
| 43 | } catch(e) { |
| 44 | errors.push(e); |
| 45 | } |
| 46 | try { |
| 47 | result = parseDateTime(str); |
| 48 | } catch(e) { |
| 49 | errors.push(e); |
| 50 | } |
| 51 | |
| 52 | // if both methods resulted in errors |
| 53 | if(errors.length === 2) { |
| 54 | throw errors.pop(); |
| 55 | } |
| 56 | |
| 57 | return result; |
| 58 | } |
nothing calls this directly
no test coverage detected