From e76bd68d2b6552c31ca2f4248456389d431e68ec Mon Sep 17 00:00:00 2001 From: b-at-neu Date: Fri, 10 Apr 2026 13:44:43 -0400 Subject: [PATCH 1/3] #654 fix purchase amounts not showing two decimal places Co-Authored-By: Claude Sonnet 4.6 --- lib/utils.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/utils.ts b/lib/utils.ts index 639d59a5..fab47db1 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -7,8 +7,10 @@ export function cn(...inputs: ClassValue[]) { } function formatAbsoluteNumber(value: number) { - const rounded = Math.round(value * 100) / 100; - return rounded.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ','); + return new Intl.NumberFormat('en-US', { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }).format(value); } export function formatNumber(value: number) { From ff5339a9692748bdb1a3910552da4814bdced235 Mon Sep 17 00:00:00 2001 From: b-at-neu Date: Fri, 10 Apr 2026 23:28:45 -0400 Subject: [PATCH 2/3] #654 fix amount input not showing two decimal places in edit purchase Co-Authored-By: Claude Sonnet 4.6 --- components/ui/form-input.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/components/ui/form-input.tsx b/components/ui/form-input.tsx index 29af70b5..68975ce2 100644 --- a/components/ui/form-input.tsx +++ b/components/ui/form-input.tsx @@ -37,6 +37,7 @@ function FormInput({ ...inputProps }: FormInputProps) { const form = useFormContext(); + const [isFocused, setIsFocused] = React.useState(false); return ( ({ setIsFocused(true)} + onBlur={() => { + setIsFocused(false); + field.onBlur(); + }} className={cn('rounded-l-none', inputProps.className)} /> From 6110ab9915579889189290e602fe895de67fc038 Mon Sep 17 00:00:00 2001 From: b-at-neu Date: Fri, 10 Apr 2026 23:39:52 -0400 Subject: [PATCH 3/3] #654 show two decimal places on focus in currency input Co-Authored-By: Claude Sonnet 4.6 --- components/ui/form-input.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/components/ui/form-input.tsx b/components/ui/form-input.tsx index 68975ce2..0bcffd52 100644 --- a/components/ui/form-input.tsx +++ b/components/ui/form-input.tsx @@ -37,7 +37,7 @@ function FormInput({ ...inputProps }: FormInputProps) { const form = useFormContext(); - const [isFocused, setIsFocused] = React.useState(false); + const [displayValue, setDisplayValue] = React.useState(''); return ( ({ + setDisplayValue(Number(field.value || 0).toFixed(2)) } - onFocus={() => setIsFocused(true)} + onChange={(e) => { + setDisplayValue(e.target.value); + field.onChange(e.target.value); + }} onBlur={() => { - setIsFocused(false); + setDisplayValue(''); field.onBlur(); }} className={cn('rounded-l-none', inputProps.className)}