I have date duration values in following format.
array1 = '[["2022-01-18","2022-01-21"],["2022-02-15","2022-02-17"], ...]';
And need to convert it as follows,
array2 = [ '2022-01-18 - 2022-01-21', '2022-02-15 - 2022-02-17', ... ]
For the work done I have followed two ways,
formattedArray1 = array1.replace(/","/g, " - ").reduce((a, b) => a.concat(b), [])
this gives me an error:
array2.reduce is not a function
formattedArray2 = [].concat.apply([], array1.replace(/","/g, " - "));and this gives me the error
CreateListFromArrayLike called on non-object
To fix this any thought would be highly appreciated!
