mirror of
https://github.com/IT4Change/gradido.git
synced 2026-01-20 20:01:31 +00:00
20 lines
657 B
TypeScript
20 lines
657 B
TypeScript
import { Decimal } from 'decimal.js-light'
|
|
import i18n from 'i18n'
|
|
|
|
export const objectValuesToArray = (obj: { [x: string]: string }): Array<string> => {
|
|
return Object.keys(obj).map(function (key) {
|
|
return 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(' ')
|