Fix message timestamp showing incorrect relative dates.
This commit is contained in:
parent
4633062bf4
commit
d47476d5b9
@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Added
|
||||
### Fixed
|
||||
- Message formatting does not work.
|
||||
- Message dates no longer show 2 days ago as 'Yesterday'.
|
||||
|
||||
### Changed
|
||||
### Removed
|
||||
|
@ -16,7 +16,7 @@ const MessageTimestamp: FunctionComponent<MessageTimestampProps> = ({ message })
|
||||
function getTimestamp() {
|
||||
const wasToday = midnight.getDate() === createdAt.getDate();
|
||||
if (wasToday) return '[Today at] HH:mm';
|
||||
else if (daysAgo === 1) return '[Yesterday at] HH:mm';
|
||||
else if (daysAgo <= 1) return '[Yesterday at] HH:mm';
|
||||
return 'DD/MM/YYYY';
|
||||
}
|
||||
return <span>{moment(createdAt).format(getTimestamp())}</span>;
|
||||
|
@ -14,7 +14,7 @@ export class FormatService {
|
||||
codeLine: /`(.*?)`/gs,
|
||||
blockQuoteMultiline: />>> (.*)/gs,
|
||||
blockQuoteLine: /^> (.*)$/gm,
|
||||
url: /(https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*))/gm,
|
||||
url: /(https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+~#?&//=]*))/gm,
|
||||
};
|
||||
|
||||
public toHTML(content: string) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user