I have this function in my scripts and Internet Explorer throws an error: "el objeto no acepta la propiedad o el metodo trunc" which means something like "the object doesn't accept property or method trunc"
function minutesToString(a){
var hours = Math.trunc(a/60);
var minutes = a % 60;
return(hours +" hr "+ minutes + " m");
}
On chrome, firefox, etc. works perfectly.
Add a polyfill for Math.trunc(). Include the following code somewhere before using Math.trunc()
Math.trunc = Math.trunc || function(x) {
if (isNaN(x)) {
return NaN;
}
if (x > 0) {
return Math.floor(x);
}
return Math.ceil(x);
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With