@ews-admin/global-design-system 1.11.0 → 1.12.0

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.
@@ -20,13 +20,10 @@ export declare function cn(...inputs: ClassValue[]): string;
20
20
  * @returns Formatted currency string
21
21
  */
22
22
  export declare function formatCurrency(amount: number, currency?: string): string;
23
- /**
24
- * Utility function to format date
25
- * @param date - Date to format
26
- * @param options - Intl.DateTimeFormat options
27
- * @returns Formatted date string
28
- */
29
- export declare function formatDate(date: Date | string | number, options?: Intl.DateTimeFormatOptions): string;
23
+ export interface FormatDateOptions extends Intl.DateTimeFormatOptions {
24
+ locale?: string | string[];
25
+ }
26
+ export declare function formatDate(date: Date | string | number, options?: FormatDateOptions): string;
30
27
  /**
31
28
  * Utility function to debounce function calls
32
29
  * @param func - Function to debounce
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAE7C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EACL,aAAa,EACb,iCAAiC,EACjC,gCAAgC,EAChC,qBAAqB,GACtB,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AACzE,YAAY,EACV,SAAS,EACT,kBAAkB,EAClB,WAAW,GACZ,MAAM,cAAc,CAAC;AAEtB;;GAEG;AACH,eAAO,MAAM,QAAQ,QAAQ,CAAC;AAE9B;;;;GAIG;AACH,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,SAAW,GAAG,MAAM,CAK1E;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,IAAI,GA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3
+ "version": "1.12.0",
4
4
  "description": "EWS Global Design System - Reusable components for EWS applications",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -71,7 +71,7 @@
71
71
  "build-storybook": "storybook build",
72
72
  "test": "jest",
73
73
  "lint": "eslint src --ext .ts,.tsx",
74
- "type-check": "tsc --noEmit",
74
+ "typecheck": "tsc --noEmit",
75
75
  "publish:patch": "pnpm version patch && pnpm publish --access public",
76
76
  "publish:minor": "pnpm version minor && pnpm publish --access public",
77
77
  "publish:major": "pnpm version major && pnpm publish --access public",
package/src/index.ts CHANGED
@@ -53,6 +53,7 @@ export {
53
53
  extractCountryCodeFromPhoneNumber,
54
54
  formatCurrency,
55
55
  formatDate,
56
+ type FormatDateOptions,
56
57
  formatNumeric,
57
58
  formatPhoneNumberWithCountryCode,
58
59
  generateId,
@@ -41,22 +41,21 @@ export function formatCurrency(amount: number, currency = CURRENCY): string {
41
41
  }).format(amount);
42
42
  }
43
43
 
44
- /**
45
- * Utility function to format date
46
- * @param date - Date to format
47
- * @param options - Intl.DateTimeFormat options
48
- * @returns Formatted date string
49
- */
44
+ export interface FormatDateOptions extends Intl.DateTimeFormatOptions {
45
+ locale?: string | string[];
46
+ }
47
+
50
48
  export function formatDate(
51
49
  date: Date | string | number,
52
- options?: Intl.DateTimeFormatOptions
50
+ options?: FormatDateOptions
53
51
  ): string {
52
+ const { locale = "en-US", ...intlOptions } = options ?? {};
54
53
  const dateObj = new Date(date);
55
- return new Intl.DateTimeFormat("en-US", {
54
+ return new Intl.DateTimeFormat(locale, {
56
55
  year: "numeric",
57
56
  month: "long",
58
57
  day: "numeric",
59
- ...options,
58
+ ...intlOptions,
60
59
  }).format(dateObj);
61
60
  }
62
61