I am Integration bryntum scheduler in an existing application: Odoo
The scheduler fixes the Polyfill bug in libs/Common/helper/DomHelper.js by overwriting the Number prototype.
However Odoo depends on this function and now there are rounding errors in the Odoo frontend.
For example product price of 1.5 becomes 1.51 because of the patched call of toFixed.
Do you see a workaround for this problem? Any suggestion/tip would be really helpful.
To test please copy the following code snippet of the scheduler in the js console and then execute
console.log("before patch "+(1.5).toFixed(2));
if (1.005.toFixed(2) !== '1.01') {
var numberPrototype = Number.prototype,
toFixed = numberPrototype.toFixed;
numberPrototype.toFixed = function (fractionDigits) {
var split = this.toString().split('.'),
number = +(!split[1] ? split[0] : split.join('.') + '1');
return toFixed.call(number, fractionDigits);
};
}
console.log("after patch "+(1.5).toFixed(2));
Last edited by KAB on Fri Mar 15, 2019 8:47 pm, edited 1 time in total.
The problem still exist with latest version.
Please just copy&paste the snippet in a fresh JS console (the patched function is taken from lib/common/helper/Domhelper.js)
We have decided to remove our polyfill and use other means to achieve what we needed it for. It will be gone in the next major release (2.0). Ticket to track it here: https://app.assembla.com/spaces/bryntum/tickets/7823
Thanks for the quick update.
Is there a backport of the bugfix to the latest scheduler version? My client cannot wait until the major 2.0 release as the scheduler is already used in production and this bug is blocking.