mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
18 lines
680 B
TypeScript
18 lines
680 B
TypeScript
import { Decimal } from 'decimal.js-light'
|
|
import i18n from 'i18n'
|
|
|
|
export const objectValuesToArray = (obj: Record<string, string>): string[] =>
|
|
// eslint-disable-next-line security/detect-object-injection
|
|
Object.keys(obj).map((key) => obj[key])
|
|
|
|
export const decimalSeparatorByLanguage = (a: Decimal, language: string): string => {
|
|
const rememberLocaleToRestore = i18n.getLocale()
|
|
i18n.setLocale(language)
|
|
const result = a.toFixed(2).replace('.', i18n.__('general.decimalSeparator'))
|
|
i18n.setLocale(rememberLocaleToRestore)
|
|
return result
|
|
}
|
|
|
|
export const fullName = (firstName: string, lastName: string): string =>
|
|
[firstName, lastName].filter(Boolean).join(' ')
|