UNPKG

851 BJavaScriptView Raw
1import PropTypes from 'prop-types';
2import dayjs from 'dayjs';
3export const StylePropType = PropTypes.oneOfType([
4 PropTypes.array,
5 PropTypes.object,
6 PropTypes.number,
7 PropTypes.bool,
8]);
9export function isSameDay(currentMessage, diffMessage) {
10 if (!diffMessage || !diffMessage.createdAt) {
11 return false;
12 }
13 const currentCreatedAt = dayjs(currentMessage.createdAt);
14 const diffCreatedAt = dayjs(diffMessage.createdAt);
15 if (!currentCreatedAt.isValid() || !diffCreatedAt.isValid()) {
16 return false;
17 }
18 return currentCreatedAt.isSame(diffCreatedAt, 'day');
19}
20export function isSameUser(currentMessage, diffMessage) {
21 return !!(diffMessage &&
22 diffMessage.user &&
23 currentMessage.user &&
24 diffMessage.user._id === currentMessage.user._id);
25}
26//# sourceMappingURL=utils.js.map
\No newline at end of file