Thread: Array in IE.

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2004
    Posts
    72
    Rep Power
    13

    Array in IE.


    I have some codes here:
    .....
    b['30-Aug-2017'] = 50;
    b['31-Aug-2017'] = 30;
    b['1-Sep-2017'] = 20;
    ....
    var day = new Date().toLocaleDateString('en-GB', {day : 'numeric', month : 'short',year : 'numeric'}).split(' ').join('-');
    var dstr = day.toString();
    var dval = b[dstr];

    alert(day + " " + dstr + " " + dval);

    why in IE, dval is undefined? how to fix this?

    Thanks.
  2. #2
  3. Lazy Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,335
    Rep Power
    9645
    Ha ha ha, this is so stupid.

    IE puts U+200E LEFT-TO-RIGHT MARKs in there. All over it.

    You should be able to .replace(/\u200e/g, "") them all out.


    This is why nobody likes you, IE.

    (In its defense, ECMA says the exact values from toLocaleDateString are implementation dependent, so IE isn't actually breaking any rules.)
    Last edited by requinix; August 30th, 2017 at 01:46 PM.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2004
    Posts
    72
    Rep Power
    13
  6. #4
  7. Lazy Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,335
    Rep Power
    9645

IMN logo majestic logo threadwatch logo seochat tools logo