fix: normalize "in less than a minute" to "now" in chat list timestamp (#13874)
This commit is contained in:
@@ -54,6 +54,7 @@ describe('#dateFormat', () => {
|
|||||||
describe('#shortTimestamp', () => {
|
describe('#shortTimestamp', () => {
|
||||||
// Test cases when withAgo is false or not provided
|
// Test cases when withAgo is false or not provided
|
||||||
it('returns correct value without ago', () => {
|
it('returns correct value without ago', () => {
|
||||||
|
expect(shortTimestamp('in less than a minute')).toEqual('now');
|
||||||
expect(shortTimestamp('less than a minute ago')).toEqual('now');
|
expect(shortTimestamp('less than a minute ago')).toEqual('now');
|
||||||
expect(shortTimestamp('1 minute ago')).toEqual('1m');
|
expect(shortTimestamp('1 minute ago')).toEqual('1m');
|
||||||
expect(shortTimestamp('12 minutes ago')).toEqual('12m');
|
expect(shortTimestamp('12 minutes ago')).toEqual('12m');
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ export const shortTimestamp = (time, withAgo = false) => {
|
|||||||
const suffix = withAgo ? ' ago' : '';
|
const suffix = withAgo ? ' ago' : '';
|
||||||
const timeMappings = {
|
const timeMappings = {
|
||||||
'less than a minute ago': 'now',
|
'less than a minute ago': 'now',
|
||||||
|
'in less than a minute': 'now',
|
||||||
'a minute ago': `1m${suffix}`,
|
'a minute ago': `1m${suffix}`,
|
||||||
'an hour ago': `1h${suffix}`,
|
'an hour ago': `1h${suffix}`,
|
||||||
'a day ago': `1d${suffix}`,
|
'a day ago': `1d${suffix}`,
|
||||||
|
|||||||
Reference in New Issue
Block a user