Label "Since June" for users who had an account prior to 2022-06-20 (#659)

This commit is contained in:
Austin Chen 2022-07-18 15:55:17 -07:00 committed by GitHub
parent 781de79b97
commit 47a27bf3fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,6 +15,13 @@ export const PortfolioValueSection = memo(
const lastPortfolioMetrics = last(portfolioHistory) const lastPortfolioMetrics = last(portfolioHistory)
const [portfolioPeriod, setPortfolioPeriod] = useState<Period>('allTime') const [portfolioPeriod, setPortfolioPeriod] = useState<Period>('allTime')
// PATCH: If portfolio history started on June 1st, then we label it as "Since June"
// instead of "All time"
const allTimeLabel =
portfolioHistory[0].timestamp < Date.parse('2022-06-20T00:00:00.000Z')
? 'Since June'
: 'All time'
if (portfolioHistory.length === 0 || !lastPortfolioMetrics) { if (portfolioHistory.length === 0 || !lastPortfolioMetrics) {
return <></> return <></>
} }
@ -39,7 +46,7 @@ export const PortfolioValueSection = memo(
setPortfolioPeriod(e.target.value as Period) setPortfolioPeriod(e.target.value as Period)
}} }}
> >
<option value="allTime">All time</option> <option value="allTime">{allTimeLabel}</option>
<option value="weekly">7 days</option> <option value="weekly">7 days</option>
<option value="daily">24 hours</option> <option value="daily">24 hours</option>
</select> </select>