* refactor: use union type in `DateConstructor`
Add support for union types in `DateConstructor`
This will add support for something like the below;
`
let date; string | number;
const date = new Date(x);
`
Closes: #21758
* fix: date constructor can't be passed `string | Date`, but takes either individually
Closes: #20900
* fix: `matchedText` was not properly extract the correct parts from the candidate
closes: #21636
* core: replace `substr` with `substring` in `matchedText`
* test: remove redundant code from tests