IE's toLocaleString has strange characters in results

后端 未结 5 1218
不知归路
不知归路 2020-12-01 18:21

I\'ve run into a super strange thing that apparently is IE-specific in toLocaleString on dates.

In the IE console window:

new Date(\"201         


        
5条回答
  •  自闭症患者
    2020-12-01 18:26

    Please look at http://jsbin.com/mehowehase/1/edit?html,js,console

    var dt = new Date();
    var x = dt.toLocaleDateString();
    console.log("length : "+x.length);
    var arr = x.split("/");
    console.log("month : "+parseInt(arr[0],10));
    

    In the above the length of x is 14 in IE but 9 in other browsers. This supports John's comment that IE is adding left-to-right marks. This definitely looks like a bug to me.

提交回复
热议问题