Skip to content

Commit

Permalink
fixup! fixup! Properly handle nulls in number type fields
Browse files Browse the repository at this point in the history
  • Loading branch information
swansontec committed May 22, 2024
1 parent d119ae1 commit 045f1d2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ export const getStartOfMonthsFromNow = (
return new Date(Date.UTC(year, month + months, 1, 0, 0, 0, 0))
}

/**
* Parses number strings, treating blank inputs as 0
*/
export const safeParseFloat = (val: string): number => {
if (val === '') return 0
return parseFloat(val)
Expand Down

0 comments on commit 045f1d2

Please sign in to comment.