From c1131a374ba028f8f085ec9cd0c9cccc26cdc9ef Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Thu, 5 Dec 2019 01:09:08 -0500 Subject: [PATCH] hopefully stop app crashes because of bad dates https://github.com/GoogleChrome/lighthouse/issues/1056 --- ui/component/dateTime/view.jsx | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/ui/component/dateTime/view.jsx b/ui/component/dateTime/view.jsx index 2fb407ced..581c7d678 100644 --- a/ui/component/dateTime/view.jsx +++ b/ui/component/dateTime/view.jsx @@ -14,16 +14,8 @@ class DateTime extends React.PureComponent { static SHOW_TIME = 'time'; static SHOW_BOTH = 'both'; - static defaultProps = { - formatOptions: { - month: 'long', - day: 'numeric', - year: 'numeric', - }, - }; - render() { - const { date, formatOptions, timeAgo } = this.props; + const { date, timeAgo } = this.props; const show = this.props.show || DateTime.SHOW_BOTH; if (timeAgo) { @@ -32,9 +24,7 @@ class DateTime extends React.PureComponent { return ( - {date && - (show === DateTime.SHOW_BOTH || show === DateTime.SHOW_DATE) && - date.toLocaleDateString(undefined, formatOptions)} + {date && (show === DateTime.SHOW_BOTH || show === DateTime.SHOW_DATE) && moment(date).format('MMMM Do, YYYY')} {show === DateTime.SHOW_BOTH && ' '} {date && (show === DateTime.SHOW_BOTH || show === DateTime.SHOW_TIME) && date.toLocaleTimeString()} {!date && '...'}