Skip to content

Commit

Permalink
fix for IE
Browse files Browse the repository at this point in the history
  • Loading branch information
abolognino committed Jun 10, 2018
1 parent ede4318 commit e41c2d0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/SolutionSalts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class SolutionSalts extends Component<SolutionSaltsProps, {}> {
}

saltToPanel(idx: number, s: SaltUi) {
let qty = (s.dg >= 0 ? s.dg + "g " : "");
let qty = (s.dg >= 0 ? s.dg + "dg " : "");
return <Panel key={idx} eventKey={idx}
className="saltPanel panel-success"
expanded={this.props.salts[idx].visible}
Expand Down
7 changes: 7 additions & 0 deletions src/components/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
export const infiniteChar = "\u221e";

export function qtyToNumber(svalue: string): number {
/* polyfill for IE */
if (!String.prototype.startsWith) {
String.prototype.startsWith = function(search, pos) {
return this.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
};
}

var value = svalue;
if (value.startsWith(infiniteChar) && value.length > 1) {
value = value.replace(infiniteChar, "");
Expand Down
4 changes: 2 additions & 2 deletions src/containers/Rabdo.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as React from 'react';
import {Component} from 'react';
import {State, water, SaltUi, WaterUi, CalcResult, Water, Salt, RecipeUi, CalcResultUi, Result} from "../model/index";
import {State, water, SaltUi, WaterUi, Result} from "../model/index";
import {connect} from "react-redux";
import {Button, ButtonGroup, Form, FormGroup, Glyphicon, PageHeader} from "react-bootstrap";
import {Button, Form, FormGroup, Glyphicon, PageHeader} from "react-bootstrap";
import './Rabdo.css'
import { Actions } from "../actions";
import 'react-select/dist/react-select.css'
Expand Down

0 comments on commit e41c2d0

Please sign in to comment.