var utcDate= new Date(utcString);
The basic issue in the replace method on a date (that I got from the formatted date object) was, it was appending some invisible characters or non-printable characters and these characters are known as Zero-width characters.
If you debug the running code from the debug console window of IE, copy the date value during debugging the date variable value (using step by step debugging with F10) and paste it on some editor, you will not be able to see that character.
There are different categories of non-printable characters, generally termed as Zero-Width Space, Non-Joiner, Joiner characters and their corresponding Unicode comes in a format as U+200B, U+200C, U+200D, etc.
The trick to check the Zero-Width Characters:
Paste the copied value from IE in the chrome browser console window, but don’t press enter. If you press enter, then the character will not print, so you will not be able to see that character.
When you are able to see character, hover over that character, then you will be able to see the Unicode representation of that character as shown in the screenshot below :
In my case, it was appending character with Unicode ‘\u200e’.
var correctDate= myDate.replace(‘\u200e’);
So you can try the above trick to check the character code of the Zero-Width character.