You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Issue in Edge but not in chrome
var t = dt.toLocaleTimeString(); // Say it returns 13:04:26
var tArr = t.split(':');
console.log(parseInt(tArr[0], 10); // returns NaN in Edge, other browsers return 13
console.log(+tArr[0]); // returns NaN in Edge, other browsers return 13
console.log(1 * tArr[0]); // returns NaN in Edge, other browsers return 13
// Solution to the problem for Edge and possibly IE11
function removeNonAscii(str) {
var regx = new RegExp("[^\u0000-\u007F]", "g");
return str.replace(regx, '');
}
var t = removeNonAscii(dt.toLocaleTimeString()); // Say it returns 13:04:26
var tArr = t.split(':');
console.log(parseInt(tArr[0], 10); // returns 13
console.log(+tArr[0]); // returns 13
console.log(1 * tArr[0]); // returns 13
The text was updated successfully, but these errors were encountered:
// Issue in Edge but not in chrome
var t = dt.toLocaleTimeString(); // Say it returns 13:04:26
var tArr = t.split(':');
console.log(parseInt(tArr[0], 10); // returns NaN in Edge, other browsers return 13
console.log(+tArr[0]); // returns NaN in Edge, other browsers return 13
console.log(1 * tArr[0]); // returns NaN in Edge, other browsers return 13
// Solution to the problem for Edge and possibly IE11
function removeNonAscii(str) {
var regx = new RegExp("[^\u0000-\u007F]", "g");
return str.replace(regx, '');
}
var t = removeNonAscii(dt.toLocaleTimeString()); // Say it returns 13:04:26
var tArr = t.split(':');
console.log(parseInt(tArr[0], 10); // returns 13
console.log(+tArr[0]); // returns 13
console.log(1 * tArr[0]); // returns 13
The text was updated successfully, but these errors were encountered: