Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3354119
D6333.id21176.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D6333.id21176.diff
View Options
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 @@
</a>
);
}
- 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
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 11:49 AM (19 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2575476
Default Alt Text
D6333.id21176.diff (1 KB)
Attached To
Mode
D6333: [web] Factor out prettyDateWithoutDay
Attached
Detach File
Event Timeline
Log In to Comment