Skip to content

Commit 6135523

Browse files
authored
Merge pull request #808 from glints-dev/feature/currency-input-allow-zero
feat: allow 0 for currency input
2 parents c28a561 + a539480 commit 6135523

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/@next/CurrencyInput/CurrencyInput.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export const CurrencyInput = React.forwardRef<
8585
return '$';
8686
};
8787

88-
const formattedValue = formatter.format(getRawNumber(value.toString()));
88+
const formattedValue = formatter.format(getRawNumber(value.toString())) ?? '';
8989

9090
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
9191
const rawValue = getRawNumber(e.currentTarget.value);
@@ -102,7 +102,7 @@ export const CurrencyInput = React.forwardRef<
102102
</div>
103103
}
104104
{...props}
105-
value={formattedValue === '0' ? '' : formattedValue}
105+
value={formattedValue}
106106
onChange={handleChange}
107107
/>
108108
);

0 commit comments

Comments
 (0)