From 4e47ecaf348e3a2d83d5412d14fd0521bb7c8f27 Mon Sep 17 00:00:00 2001 From: Kunal Marwaha Date: Thu, 11 Mar 2021 01:46:59 -0800 Subject: [PATCH] Add date to site --- src/App.js | 12 +++++++++++ src/components/time-to-herd/time-to-herd.jsx | 21 ++++++++++++-------- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/App.js b/src/App.js index fc4bac6..5fddeb4 100644 --- a/src/App.js +++ b/src/App.js @@ -129,6 +129,18 @@ export default function App() { }} /> + +  () +

until {herdImmunityThresholdPercentage}% of the population is diff --git a/src/components/time-to-herd/time-to-herd.jsx b/src/components/time-to-herd/time-to-herd.jsx index 86d7c6a..f813840 100644 --- a/src/components/time-to-herd/time-to-herd.jsx +++ b/src/components/time-to-herd/time-to-herd.jsx @@ -2,6 +2,7 @@ import React, { useState, useEffect } from "react"; import CountUp from "react-countup"; import "./country-section.css"; import { CountriesMasterList } from "../../shared/data-factory.js"; +import moment from 'moment'; export const TimeToHerdCount = ({ selectedCountry, @@ -9,6 +10,7 @@ export const TimeToHerdCount = ({ requestedData, requestedDataAsPercent, herdImmunityThresholdPercentage, + addDays = false, }) => { const [ herdImmunityVaccinationThreshold, @@ -154,14 +156,17 @@ export const TimeToHerdCount = ({ return ( <> - {requestedDataAsPercent ? ( - - ) : ( - + {addDays ? + (moment().add(requestedDataValue, 'days').format("YYYY MMMM DD")) + : (requestedDataAsPercent ? ( + + ) : ( + + ) )} );