@capillarytech/cap-ui-utils 1.4.19 → 1.4.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capillarytech/cap-ui-utils",
3
- "version": "1.4.19",
3
+ "version": "1.4.21",
4
4
  "description": "Utility functions shared accross all the modules",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -114,17 +114,14 @@ function truncateNumber(num, places) {
114
114
  }
115
115
 
116
116
  export const getUserLocale = (currentOrgDetails) => {
117
- const { basic_details } = currentOrgDetails;
118
- const { base_country_code, base_language } = basic_details || {};
119
- if (base_language && base_country_code)
120
- return `${base_language}-${base_country_code}`;
121
- // Returning en-US as default locale case
122
- return "en-US";
117
+ const { basic_details = {} } = currentOrgDetails;
118
+ const { base_country_code = "US", base_language = "en" } = basic_details;
119
+ return `${base_language}-${base_country_code}`;
123
120
  };
124
121
 
125
122
  function localeBasedNumberFormatting(value, currentOrgDetails = {}) {
126
123
  const userLocale = getUserLocale(currentOrgDetails);
127
- const formattedValue = new Intl.NumberFormat(locale, {
124
+ const formattedValue = new Intl.NumberFormat(userLocale, {
128
125
  maximumFractionDigits: 2,
129
126
  }).format(value);
130
127
  return formattedValue;