Skip to content

Commit

Permalink
Merge pull request #1405 from bcgov/fix/daniel-allow-negative-symbol-…
Browse files Browse the repository at this point in the history
…1388

fix: Allow negative symbol in transaction amount input
  • Loading branch information
dhaselhan authored Dec 10, 2024
2 parents f437eec + 4db9dc3 commit 9d09d69
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export const UserProfileActions = () => {
refetchInterval: 60000 // Automatically refetch every 1 minute (60000ms)
})
const notificationsCount = notificationsData?.count || 0
console.log(notificationsData)

// Call refetch whenever the route changes
useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,11 @@ export const TransactionDetails = ({ transactionId, isEditable }) => {
helperText={errors.complianceUnits?.message}
value={formattedValue}
onChange={(e) => {
// Remove all non-digit characters
const numericValue = e.target.value.replace(/\D/g, '')
// Remove all non-digit characters (other than - at the front)
const numericValue = e.target.value.replace(
/(?!^-)[^0-9]/g,
''
)
// Update the form state with the raw number
onChange(numericValue)
}}
Expand Down

0 comments on commit 9d09d69

Please sign in to comment.