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
{{ message }}
This repository was archived by the owner on Oct 5, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Oct 5, 2026. It is now read-only.
BREAKING BUG: Calculation error, code treats '000 separator as decimal point #4
What should happen:
The bottom right cell should result in EUR3132.
I am using the default "en" currency code. But it doesn't matter if I use de-DE etc.
The same error is made with DIV etc.- the code takes any source value and truncates any '000 separator as if it was a decimal point.
In my settings, the max decimal place for fractions was set to 0. Basically the current code takes $1,200 and converts it to 1.2 as it looks to a decimal place to determine that "," is a '000 separator, and since it didn't find one, thinks that it is a decimal separator.
The temporary fix is to set it to a positive integer, e.g. 1
Code fix in the function extractNumber():
extractNumber(str: string | null): number | null {
...
// --- Error code: This logic treats commas as decimal for US format like "1,200" ---
//
// const commaIndex = numStr.lastIndexOf(',');
// const dotIndex = numStr.lastIndexOf('.');
// if (commaIndex > dotIndex) {
// numStr = numStr.replace(/\./g, '').replace(',', '.');
// } else {
// numStr = numStr.replace(/,/g, '');
// }
//
// --- Improved logic: Parses both US and European formats ---
if (numStr.match(/^\d{1,3}(,\d{3})+(\.\d+)?$/)) {
// US-style: "1,234.56" → "1234.56"
numStr = numStr.replace(/,/g, '');
} else if (numStr.match(/^\d{1,3}(\.\d{3})+(,\d+)?$/)) {
// European-style: "1.234,56" → "1234.56"
numStr = numStr.replace(/\./g, '').replace(',', '.');
} else if (numStr.match(/^\d+(,\d+)?$/)) {
// "1234,56" → "1234.56"
numStr = numStr.replace(',', '.');
}
// --- End Improved Code ---
const result = parseFloat(numStr);
return !isNaN(result) ? result : null;
Hey @moontango, sorry for the late reply to this. Had health issues, but i'm back now. 💪
I just released 0.2.4 which uses numeral.js instead for number extraction, as there were even more edge cases and it just became a hassle to cover them all 😆
Activity
moontango commentedon Aug 27, 2025
I've found the issue.
In my settings, the max decimal place for fractions was set to 0. Basically the current code takes $1,200 and converts it to 1.2 as it looks to a decimal place to determine that "," is a '000 separator, and since it didn't find one, thinks that it is a decimal separator.
The temporary fix is to set it to a positive integer, e.g. 1
Code fix in the function extractNumber():
eatcodeplay commentedon Sep 19, 2025
Hey @moontango, sorry for the late reply to this. Had health issues, but i'm back now. 💪
I just released
0.2.4which uses numeral.js instead for number extraction, as there were even more edge cases and it just became a hassle to cover them all 😆Let me know if that works for you now! 🤗
moontango commentedon Sep 23, 2025
Just updated and set the decimal place to 0. Everything's working great, thanks!