Browse Source

Task/refactor common helper (#6251)

* Refactoring
pull/6254/head^2
Thomas Kaul 3 days ago
committed by GitHub
parent
commit
5de2b02a04
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 14
      libs/common/src/lib/helper.ts

14
libs/common/src/lib/helper.ts

@ -223,8 +223,8 @@ export function getDateFormatString(aLocale?: string) {
); );
return formatObject return formatObject
.map((object) => { .map(({ type, value }) => {
switch (object.type) { switch (type) {
case 'day': case 'day':
return 'dd'; return 'dd';
case 'month': case 'month':
@ -232,7 +232,7 @@ export function getDateFormatString(aLocale?: string) {
case 'year': case 'year':
return 'yyyy'; return 'yyyy';
default: default:
return object.value; return value;
} }
}) })
.join(''); .join('');
@ -271,8 +271,8 @@ export function getLowercase(object: object, path: string) {
export function getNumberFormatDecimal(aLocale?: string) { export function getNumberFormatDecimal(aLocale?: string) {
const formatObject = new Intl.NumberFormat(aLocale).formatToParts(9999.99); const formatObject = new Intl.NumberFormat(aLocale).formatToParts(9999.99);
return formatObject.find((object) => { return formatObject.find(({ type }) => {
return object.type === 'decimal'; return type === 'decimal';
})?.value; })?.value;
} }
@ -281,8 +281,8 @@ export function getNumberFormatGroup(aLocale = getLocale()) {
useGrouping: true useGrouping: true
}).formatToParts(9999.99); }).formatToParts(9999.99);
return formatObject.find((object) => { return formatObject.find(({ type }) => {
return object.type === 'group'; return type === 'group';
})?.value; })?.value;
} }

Loading…
Cancel
Save