Skip to content

Commit

Permalink
Merge pull request #1164 from massgov/release/9.55.1
Browse files Browse the repository at this point in the history
Release 9.55.1
  • Loading branch information
clairesunstudio authored Sep 2, 2020
2 parents 5fe01b6 + a362321 commit 4587f17
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Mayflower Release Notes
All notable changes to this project will be documented in this file.

## 9.55.1 (9/2/2020)
### Fixed
- (React) [InputCurrency] Fix onBlur bug to allow value 0 to be returned in onBlur callback. (#1161)
- (React) [InputCurrency] Fix onBlur bug to allow onBlur callback to fire on input with `$`. (#1163)

## 9.55.0 (8/24/2020)
### Changed
- (React) [MainNav] DP-19425: Fix formatting of COVID global nav link on search.mass.gov (#1143)
Expand Down
13 changes: 7 additions & 6 deletions react/src/components/forms/InputCurrency/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,16 @@ const Currency = (props) => {
const handleBlur = (e) => {
const { type } = e;
const inputEl = ref.current;
const stringValue = inputEl.value;
// isNotNumber returns true if stringValue is null, undefined or 'NaN'
const value = inputEl && inputEl.value;
const numberValue = value && Number(numbro.unformat(value.replace('$', '')));

// isNotNumber returns true if value is null, undefined or NaN vs Number.isNaN only checks if value is NaN
/* eslint-disable-next-line no-restricted-globals */
const isNotNumber = !stringValue || isNaN(Number(numbro.unformat(stringValue)));
const isNotNumber = isNaN(numberValue);
if (isNotNumber) {
inputEl.setAttribute('placeholder', props.placeholder);
}
let newValue = isNotNumber ? '' : Number(numbro.unformat(stringValue));
if (!is.empty(newValue)) {
} else {
let newValue = numberValue;
if (hasNumberProperty(props, 'max') && newValue > props.max) {
newValue = props.max;
}
Expand Down

0 comments on commit 4587f17

Please sign in to comment.