Make split number helper handle empty value (#20848)

no issues
This commit is contained in:
Sodbileg Gansukh 2024-08-28 18:47:03 +08:00 committed by GitHub
parent 5cc3d943f2
commit 3b38ba3a29
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3,6 +3,10 @@ import {helper} from '@ember/component/helper';
import {htmlSafe} from '@ember/template'; import {htmlSafe} from '@ember/template';
export function splitNumber([number, previousNumber]) { export function splitNumber([number, previousNumber]) {
if (number === undefined || previousNumber === undefined) {
return 0;
}
let formattedNewNumber = formatNumber(number); let formattedNewNumber = formatNumber(number);
let formattedOldNumber = formatNumber(previousNumber); let formattedOldNumber = formatNumber(previousNumber);