diff --git a/lib/utils/date-utils.js b/lib/utils/date-utils.js --- a/lib/utils/date-utils.js +++ b/lib/utils/date-utils.js @@ -69,6 +69,10 @@ return dateFormat(dateFromString(dayString), 'dddd, mmmm dS, yyyy'); } +function prettyDateWithoutDay(dayString: string): string { + return dateFormat(dateFromString(dayString), 'mmmm dS, yyyy'); +} + function dateFromString(dayString: string): Date { const matches = dayString.match(/^([0-9]+)-([0-1][0-9])-([0-3][0-9])$/); invariant(matches && matches.length === 4, `invalid dayString ${dayString}`); @@ -155,6 +159,7 @@ fifteenDaysEarlier, fifteenDaysLater, prettyDate, + prettyDateWithoutDay, dateFromString, shortAbsoluteDate, longAbsoluteDate, diff --git a/web/modals/history/history-modal.react.js b/web/modals/history/history-modal.react.js --- a/web/modals/history/history-modal.react.js +++ b/web/modals/history/history-modal.react.js @@ -1,7 +1,6 @@ // @flow import classNames from 'classnames'; -import dateFormat from 'dateformat'; import invariant from 'invariant'; import _filter from 'lodash/fp/filter'; import _flow from 'lodash/fp/flow'; @@ -31,7 +30,7 @@ useServerCall, useDispatchActionPromise, } from 'lib/utils/action-utils'; -import { dateFromString } from 'lib/utils/date-utils'; +import { prettyDateWithoutDay } from 'lib/utils/date-utils'; import LoadingIndicator from '../../loading-indicator.react'; import { useSelector } from '../../redux/redux-utils'; @@ -101,8 +100,7 @@ ); } - const historyDate = dateFromString(this.props.dayString); - const prettyDate = dateFormat(historyDate, 'mmmm dS, yyyy'); + const prettyDate = prettyDateWithoutDay(this.props.dayString); const loadingStatus = this.state.mode === 'day' ? this.props.dayLoadingStatus