Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 9.55.1 #1164

Merged
merged 5 commits into from
Sep 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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