Make use of formatWithOrdinalSuffix function

This commit is contained in:
Sofiya Tepikin
2020-12-04 19:30:41 +01:00
parent 9d3c332453
commit f9eb06f197
+3 -4
View File
@@ -13,7 +13,7 @@ import Button from './common/button'
import cycleModule from '../lib/cycle' import cycleModule from '../lib/cycle'
import { getFertilityStatusForDay } from '../lib/sympto-adapter' import { getFertilityStatusForDay } from '../lib/sympto-adapter'
import { determinePredictionText, getOrdinalSuffix } from './helpers/home' import { determinePredictionText, formatWithOrdinalSuffix } from './helpers/home'
import { Colors, Fonts, Sizes, Spacing } from '../styles' import { Colors, Fonts, Sizes, Spacing } from '../styles'
import { home as labels } from '../i18n/en/labels' import { home as labels } from '../i18n/en/labels'
@@ -37,10 +37,9 @@ class Home extends Component {
const prediction = getPredictedMenses() const prediction = getPredictedMenses()
this.cycleDayText = !this.cycleDayNumber ? labels.cycleDayNotEnoughInfo this.cycleDayText = !this.cycleDayNumber ? labels.cycleDayNotEnoughInfo
: `${this.cycleDayNumber}${getOrdinalSuffix(this.cycleDayNumber)}` : formatWithOrdinalSuffix(this.cycleDayNumber)
this.phase = phase this.phase = phase
this.phaseText = !phase ? statusText this.phaseText = !phase ? statusText : formatWithOrdinalSuffix(phase)
: `${phase}${getOrdinalSuffix(phase)}`
this.prediction = determinePredictionText(prediction) this.prediction = determinePredictionText(prediction)
this.status = status this.status = status
this.statusText = statusText this.statusText = statusText