The below code is working fine in Chrome, but in IE browser I am seeing the below console error:
object does not support property or method 'trunc'
Code:
var Days = (new Date(date1) - new Date(date2)) / 50;
if (Math.trunc(Days) > 45)) {
alert("it should be less than 45 days");
}
Math.trunc is not supported in IE as MDN states, please read here.
Instead you could use polifylls:
if (!Math.trunc) {
Math.trunc = function (v) {
return v < 0 ? Math.ceil(v) : Math.floor(v);
};
}
Hope that clarifies.
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