Unlike the C#/.NET class library (and most other sensible languages), when you pass a String in as the string-to-match argument to the string.replace method, it doesn't do a string replace. It converts the string to a RegExp and does a regex substitution. As Gumbo explains, a regex substitution requires the global flag, which is not on by default, to replace all matches in one go.
If you want a real string-based replace — for example because the match-string is dynamic and might contain characters that have a special meaning in regexen — the JavaScript idiom for that is:
var id= 'c_'+date.split('/').join('');
replacelike this. I even choosestr.split(search).join(replacement)over the regexp.String.prototype.replaceAllto the standard: 2ality.com/2019/12/string-prototype-replaceall.htmldate.replaceAll('/','')