Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
@@ -1,4 +1,3 @@
|
||||
import numeral from "numeral";
|
||||
import { formatCurrency, formatNumber, formatPercent } from "~/locale/format";
|
||||
|
||||
export const defaultCurrencySymbol = "$";
|
||||
@@ -16,7 +15,7 @@ export const NumberFormats: { name: string; value: NumberFormatType; labelKey: s
|
||||
const numberFormat = (value: number): string => {
|
||||
try {
|
||||
return formatNumber(value, legacyNumberLocale, { maximumFractionDigits: 0 });
|
||||
} catch (e) {
|
||||
} catch (_e) {
|
||||
return value?.toString();
|
||||
}
|
||||
};
|
||||
@@ -26,14 +25,14 @@ const decimalFormat = (value: number, decimalPlaces: number = 2): string => {
|
||||
minimumFractionDigits: decimalPlaces,
|
||||
maximumFractionDigits: decimalPlaces,
|
||||
});
|
||||
} catch (e) {
|
||||
} catch (_e) {
|
||||
return value?.toString();
|
||||
}
|
||||
};
|
||||
const intFormat = (value: number | string): string => {
|
||||
try {
|
||||
return formatNumber(Number(value), legacyNumberLocale, { maximumFractionDigits: 0 });
|
||||
} catch (e) {
|
||||
} catch (_e) {
|
||||
return value?.toString();
|
||||
}
|
||||
};
|
||||
@@ -43,7 +42,7 @@ const currencyFormat = (value: number, currency: string = defaultCurrency, decim
|
||||
minimumFractionDigits: decimalPlaces,
|
||||
maximumFractionDigits: decimalPlaces,
|
||||
});
|
||||
} catch (e) {
|
||||
} catch (_e) {
|
||||
return `${defaultCurrencySymbol}${decimalFormat(value, decimalPlaces)}`;
|
||||
}
|
||||
};
|
||||
@@ -56,7 +55,7 @@ const percentFormat = (value: number, decimalPlaces: number = 2, locale: string
|
||||
minimumFractionDigits: decimalPlaces,
|
||||
maximumFractionDigits: decimalPlaces,
|
||||
});
|
||||
} catch (e) {
|
||||
} catch (_e) {
|
||||
return `${decimalFormat(value, decimalPlaces)}%`;
|
||||
}
|
||||
};
|
||||
@@ -64,14 +63,6 @@ const pad = (num: number, size: number) => {
|
||||
const s = "000000000" + num;
|
||||
return s.substring(s.length - size);
|
||||
};
|
||||
const custom = (value: number, format: string): string => {
|
||||
try {
|
||||
return numeral(value).format(format);
|
||||
} catch (e) {
|
||||
return value?.toString();
|
||||
}
|
||||
};
|
||||
|
||||
export default {
|
||||
numberFormat,
|
||||
decimalFormat,
|
||||
@@ -82,5 +73,4 @@ export default {
|
||||
pad,
|
||||
defaultCurrencySymbol,
|
||||
defaultCurrency,
|
||||
custom,
|
||||
};
|
||||
Reference in new issue
Block a user