feat: Show year in message timestamp if the message is not from the current year (#6830)

* feat: Shows year in message timestamp if the message is not from the current year

* chore: Naming fix
This commit is contained in:
Sivin Varghese
2023-04-06 15:09:38 +05:30
committed by GitHub
parent ee131011f9
commit ab6276327a
3 changed files with 30 additions and 4 deletions

View File

@@ -9,6 +9,20 @@ describe('#messageStamp', () => {
});
});
describe('#messageTimestamp', () => {
it('should return the message date in the specified format if the message was sent in the current year', () => {
const now = new Date();
expect(TimeMixin.methods.messageTimestamp(now.getTime() / 1000)).toEqual(
'Apr 5, 2023'
);
});
it('should return the message date and time in a different format if the message was sent in a different year', () => {
expect(TimeMixin.methods.messageTimestamp(1612971343)).toEqual(
'Feb 10 2021, 3:35 PM'
);
});
});
describe('#dynamicTime', () => {
it('returns correct value', () => {
expect(TimeMixin.methods.dynamicTime(1612971343)).toEqual(