The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/client/hooks/useFormatNumber.ts

16 lines
400 B

import { useLanguage } from '@rocket.chat/ui-contexts';
import { useCallback } from 'react';
export const useFormatNumber = (options?: Intl.NumberFormatOptions) => {
const language = useLanguage();
return useCallback(
(value: number) => {
try {
return new Intl.NumberFormat(language, options).format(value);
} catch (_error) {
return value;
}
},
[language, options],
);
};