From 06d8cd7de678214ee784ca764b1464e24d157951 Mon Sep 17 00:00:00 2001 From: Sara Vieira Date: Tue, 20 Mar 2018 10:52:55 +0000 Subject: [PATCH] fix(instances): make all prices 4 decimal points --- .../__tests__/__snapshots__/package.spec.js.snap | 2 +- .../src/components/create-instance/package.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/my-joy-instances/src/components/create-instance/__tests__/__snapshots__/package.spec.js.snap b/packages/my-joy-instances/src/components/create-instance/__tests__/__snapshots__/package.spec.js.snap index 0827008a..ea984ff0 100644 --- a/packages/my-joy-instances/src/components/create-instance/__tests__/__snapshots__/package.spec.js.snap +++ b/packages/my-joy-instances/src/components/create-instance/__tests__/__snapshots__/package.spec.js.snap @@ -1264,7 +1264,7 @@ exports[`renders without throwing 1`] = ` name="td" selected={false} > - 1 + 1.0000 `; diff --git a/packages/my-joy-instances/src/components/create-instance/package.js b/packages/my-joy-instances/src/components/create-instance/package.js index a107eb2d..991825e4 100644 --- a/packages/my-joy-instances/src/components/create-instance/package.js +++ b/packages/my-joy-instances/src/components/create-instance/package.js @@ -36,6 +36,8 @@ const GroupIcons = { COMPUTE: }; +const fourDecimals = n => parseFloat(Math.round(n * 10000) / 10000).toFixed(4); + const VerticalDivider = styled.div` width: ${remcalc(1)}; background: ${props => props.theme.grey}; @@ -166,7 +168,7 @@ export const Package = ({ )} - {price} + {fourDecimals(price)} );