Skip to content

Commit 21d3311

Browse files
Copilothckhanh
andcommitted
Fix billion suffix logic and use new Array()
Co-authored-by: hckhanh <[email protected]>
1 parent 46219a8 commit 21d3311

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/read/groups.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ function getUnitSuffix(
3131

3232
if (type === 3) {
3333
// Billion: repeat "tỷ" based on position (position 3 = "tỷ", position 6 = "tỷ tỷ", position 9 = "tỷ tỷ tỷ", etc.)
34-
if (positionFromRight >= 6 && hasTrailingZeros) {
34+
if (positionFromRight >= 3 && hasTrailingZeros) {
3535
const billionCount = Math.floor(positionFromRight / 3)
36-
return ' ' + Array(billionCount).fill('tỷ').join(' ')
36+
return ' ' + new Array(billionCount).fill('tỷ').join(' ')
3737
}
3838
return ' tỷ'
3939
}

0 commit comments

Comments
 (0)