Why does qUnit assert.equal think these 2 lines are different in IE?

I work with some qUnit tests written by another developer, and I have some problems understanding why some test in IE fails.

There is a function that can convert multiple lines of formatted lines to a UTC date and seems to work correctly. However, I am having some testing issues in IE.

To test this, I return a function (which is a number, not a standard formatted date), creating a new date from it, and then using the JavaScript function toLocaleString () to get a string that I can compare to another string that I created . The following is an example test; minus the function call, I replaced the function call with the output that I get from it.

var expectedResult = "11/11/2000 12:56:00";
var actualResult = new Date(973947360000).toLocaleString():
assert.equal(expectedResult, actualResult);

This fails, but I don’t understand why, I do not use deepEqual (), and the types are the same anyway (I debugged and checked). I think it may be prior to IE coding, but I'm not sure about 1, how to establish that it is, and 2, get around it / test it effectively. It’s worth noting that this test passes perfectly in FF and Chrome, although Chrome adds β€œPM” to the end of the date.

Any help would be greatly appreciated.

Below is a snapshot of the output from IE.

qUnit

+4
1

, , .

, .toLocaleString() Internet Explorer -, , JavaScript. .toLocaleString() 2.

.replace(/[^ -~]/g, '');

, , , .

+1

All Articles