Skip to content

Commit f435da8

Browse files
committed
Show date separator for new messages
1 parent aed3750 commit f435da8

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/components/DateSeparator/DateSeparator.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const UnMemoizedDateSeparator = (props: DateSeparatorProps) => {
3939
<hr className='str-chat__date-separator-line' />
4040
)}
4141
<div className='str-chat__date-separator-date'>
42-
{unread ? t('New') : formattedDate}
42+
{unread ? `${t('New')} - ${formattedDate}` : formattedDate}
4343
</div>
4444
{(position === 'left' || position === 'center') && (
4545
<hr className='str-chat__date-separator-line' />

src/components/DateSeparator/__tests__/DateSeparator.test.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ Dayjs.extend(calendar);
1212

1313
afterEach(cleanup); // eslint-disable-line
1414

15-
// this changes every time tests are run,
16-
// but by mocking the actual renderers tests are still deterministic
17-
const now = new Date();
15+
const now = new Date('2020-03-30T22:57:47.173Z');
1816

1917
const withContext = (props) => {
2018
const t = jest.fn((key) => key);
@@ -41,7 +39,7 @@ describe('DateSeparator', () => {
4139
const { Component, t } = withContext({ date: now, unread: true });
4240
const { queryByText } = render(Component);
4341

44-
expect(queryByText('New')).toBeInTheDocument();
42+
expect(queryByText('New - 03/30/2020')).toBeInTheDocument();
4543
expect(t).toHaveBeenCalledWith('New');
4644
});
4745

@@ -58,7 +56,7 @@ describe('DateSeparator', () => {
5856
<div
5957
className="str-chat__date-separator-date"
6058
>
61-
New
59+
New - 03/30/2020
6260
</div>
6361
</div>
6462
`);

0 commit comments

Comments
 (0)