Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue #1789 #1802

Merged
merged 3 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion frontend/model/contracts/shared/time.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ export function timeSince (datems: number, dateNow: number = Date.now()): string

if (interval >= DAYS_MILLIS * 2) {
// Make sure to replace any ordinary space character by a non-breaking one.
return humanDate(datems).replace(/\x32/g, '\xa0')
// TODO: use .replaceAll when migrating to TS.
return humanDate(datems).replace(/\x20/g, '\xa0')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't we use .replaceAll now? 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just because our Flow version would complain about it being a non-existent string property. Or maybe we could add a $FlowFixMe comment to use it now anyway

}
if (interval >= DAYS_MILLIS) {
return L('1d')
Expand Down
4 changes: 2 additions & 2 deletions frontend/model/contracts/shared/time.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ describe('timeSince', function () {
)).equal('1d')
})

it('should return current day when +48h have passed', () => {
it('should return current day (with non-breaking space) when +48h have passed', () => {
should(timeSince(
currentDate - DAYS_MILLIS * 23,
currentDate
)).equal('May 7')
)).equal('May\xa07')
})
})
Loading