From 93abaf99be102eefe742201aaba8fd9f664e420e Mon Sep 17 00:00:00 2001 From: emelko <ml.kochsiek@mailbox.org> Date: Wed, 24 Apr 2019 12:53:04 +0200 Subject: [PATCH] Nicer formatting for past bleeding prediction --- components/helpers/format-date.js | 4 ++++ components/home.js | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/components/helpers/format-date.js b/components/helpers/format-date.js index 079ea4d4..f600581e 100644 --- a/components/helpers/format-date.js +++ b/components/helpers/format-date.js @@ -7,3 +7,7 @@ export default function (date) { const formattedDate = today.equals(dateToDisplay) ? 'today' : moment(date).format('MMMM Do YYYY') return formattedDate.toLowerCase() } + +export function dateForShortDescription (date) { + return moment(date.toString()).format('dddd, MMMM Do') +} \ No newline at end of file diff --git a/components/home.js b/components/home.js index fcfb91c5..8aa51837 100644 --- a/components/home.js +++ b/components/home.js @@ -16,6 +16,7 @@ import { getFertilityStatusForDay } from '../lib/sympto-adapter' import styles, { cycleDayColor, periodColor, secondaryColor } from '../styles' import AppText from './app-text' import Button from './button' +import { dateForShortDescription } from './helpers/format-date' const ShowMoreToggler = ({ isShowingMore, onToggle }) => { const {height, width} = Dimensions.get('window') @@ -193,7 +194,7 @@ function determinePredictionText(bleedingPrediction) { } if (todayDate.isAfter(bleedingEnd)) { return predictLabels.predictionInPast( - bleedingStart.toString(), bleedingEnd.toString() + dateForShortDescription(bleedingStart), dateForShortDescription(bleedingEnd) ) } const daysToEnd = todayDate.until(bleedingEnd, ChronoUnit.DAYS) @@ -223,5 +224,4 @@ function getBleedingPredictionRange(prediction) { } else { return `0 - ${daysToEnd}` } - } \ No newline at end of file -- GitLab