Javascript comparison not working in Microsoft Edge

I created a calendar with JavaScript only; I need to compare dates of events stored in <<Element.dataset.date>>

with dates retrieved from a database, it works fine with Chrome and Firefox but not Edge.

var td = document.querySelector('td');
var date = new Date('2017-06-22');
td.dataset.date = date.toLocaleDateString();
console.log(td.dataset.date === '22/06/2017');

// Output true with Firefox and Chrome but false with Edge
      

<table>
  <tr>
    <td>1</td>
    <td>2</td>
    <td>3</td>
    <td>4</td>
    <td>5</td>
    <td>6</td>
    <td>7</td>
  </tr>
  ...
</table>
      

Run codeHide result


+3
javascript microsoft-edge


source to share


No one has answered this question yet

See similar questions:

8
toLocaleDateString () does not return dd / mm / yyyy format
five
.toLocaleDateString () Doesn't work in Firefox

or similar:

7649
How does JavaScript blocking work?
7494
How can I remove a specific element from an array in JavaScript?
7432
How to check if a string contains a substring in JavaScript?
7287
What does "use strict" do in JavaScript, and what are the reasons for it?
5722
How can I remove a property from a JavaScript object?
5670
Which operator is equal (== vs ===) should be used in JavaScript comparisons?
5101
What's the most efficient way to deeply clone an object in JavaScript?
4829
How do I include a JavaScript file in another JavaScript file?
4380
For each by an array in JavaScript?
1949
How does JavaScript.prototype work?



All Articles
Loading...
X
Show
Funny
Dev
Pics