Skip to content

Commit

Permalink
fix: User information crashing for some locales (RocketChat#30167)
Browse files Browse the repository at this point in the history
  • Loading branch information
tassoevan committed Sep 15, 2023
1 parent f1e36a5 commit e1acdda
Show file tree
Hide file tree
Showing 105 changed files with 12 additions and 9,336 deletions.
5 changes: 5 additions & 0 deletions .changeset/heavy-baboons-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

User information crashing for some locales
11 changes: 6 additions & 5 deletions apps/meteor/client/hooks/useTimeAgo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ const dayFormat = ['h:mm A', 'H:mm'] as const;

export const useTimeAgo = (): ((time: Date | number | string) => string) => {
const clockMode = useUserPreference<1 | 2>('clockMode');
const timeFormat = useSetting('Message_TimeFormat') as string;
const timeFormat = useSetting<string>('Message_TimeFormat', 'LT');
const format = clockMode !== undefined ? dayFormat[clockMode - 1] : timeFormat;
return useCallback(
(time) =>
moment(time).calendar(null, {
(time) => {
return moment(time).calendar(null, {
sameDay: format,
lastDay: moment().localeData().calendar('lastDay').replace('LT', format),
lastDay: moment().calendar('lastDay').replace('LT', format),
lastWeek: `dddd ${format}`,
sameElse: 'LL',
}),
});
},
[format],
);
};
Expand Down
1 change: 1 addition & 0 deletions apps/meteor/private/moment-locales
73 changes: 0 additions & 73 deletions apps/meteor/private/moment-locales/af.js

This file was deleted.

60 changes: 0 additions & 60 deletions apps/meteor/private/moment-locales/ar-ma.js

This file was deleted.

104 changes: 0 additions & 104 deletions apps/meteor/private/moment-locales/ar-sa.js

This file was deleted.

58 changes: 0 additions & 58 deletions apps/meteor/private/moment-locales/ar-tn.js

This file was deleted.

Loading

0 comments on commit e1acdda

Please sign in to comment.