Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
Format whole numbers without the decimal place (e.g. 1.0 should forma…
Browse files Browse the repository at this point in the history
…t as 1)

Resolves HospitalRun/frontend##120
  • Loading branch information
jkleinsc committed Jul 20, 2015
1 parent 0e40c78 commit b3a1946
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/mixins/number-format.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ export default Ember.Mixin.create({
if (isNaN(value)) {
return;
}
returnValue = Number(value).toFixed(2);
if (Math.round(value) === value) {
returnValue = Number(value).toString();
} else {
returnValue = Number(value).toFixed(2);
}
if (returnAsNumber) {
return Number(returnValue);
} else {
Expand Down

0 comments on commit b3a1946

Please # to comment.