I got date in format '20190702' and hours/minutes/seconds in format '125657'
What is the easiest way to convert it to 07/02/2019, 12:56:57
const time = "125657";
const chuncks = str.match(/.{1,2}/g).join(":"); //12:56:57
What about date?
The easiest is maybe this:
const time = "125657".replace(/(..?)(..)(..)/, "$1:$2:$3");
const date = "20190702".replace(/(....)(..)(..)/, "$2/$3/$1");
console.log(date, time);
The question mark in the first pattern could serve if the time string could have 5 digits instead of 6. If you are certain you always get 6 digits, you can leave it out.