@carbon/utilities 0.5.1 → 0.6.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.
@@ -1 +1 @@
1
- function r(l,t){return new Intl.DateTimeFormat(t?.locale,{timeStyle:t?.style??"short"}).format(l)}function i(l,t){return new Intl.DateTimeFormat(t?.locale,{dateStyle:t?.style??"medium"}).format(l)}function y(l,t){const e=t?.timeStyle??(t?.style==="tooltip"?"long":t?.style)??"short",a=t?.dateStyle??(t?.style==="tooltip"?"full":t?.style)??"medium";return new Intl.DateTimeFormat(t?.locale,{timeStyle:e,dateStyle:a}).format(l)}function o(l,t,e){const a=e?.timeStyle===null?void 0:e?.timeStyle??e?.style??"short",m=e?.dateStyle===null?void 0:e?.dateStyle??e?.style??"medium";return new Intl.DateTimeFormat(e?.locale,{timeStyle:a,dateStyle:m}).formatRange(l,t)}export{y as format,i as formatDate,o as formatRange,r as formatTime};
1
+ function i(l,t){return new Intl.DateTimeFormat(t?.locale,{timeStyle:t?.style??"short",timeZone:t?.timeZone}).format(l)}function r(l,t){return new Intl.DateTimeFormat(t?.locale,{dateStyle:t?.style??"medium",timeZone:t?.timeZone}).format(l)}function o(l,t){const e=t?.timeStyle??(t?.style==="tooltip"?"long":t?.style)??"short",m=t?.dateStyle??(t?.style==="tooltip"?"full":t?.style)??"medium";return new Intl.DateTimeFormat(t?.locale,{timeStyle:e,dateStyle:m,timeZone:t?.timeZone}).format(l)}function y(l,t,e){const m=e?.timeStyle===null?void 0:e?.timeStyle??e?.style??"short",a=e?.dateStyle===null?void 0:e?.dateStyle??e?.style??"medium";return new Intl.DateTimeFormat(e?.locale,{timeStyle:m,dateStyle:a,timeZone:e?.timeZone}).formatRange(l,t)}export{o as format,r as formatDate,y as formatRange,i as formatTime};
@@ -1 +1 @@
1
- "use strict";var n=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var o=(l,t)=>{for(var e in t)n(l,e,{get:t[e],enumerable:!0})},d=(l,t,e,m)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of i(t))!y.call(l,a)&&a!==e&&n(l,a,{get:()=>t[a],enumerable:!(m=r(t,a))||m.enumerable});return l};var S=l=>d(n({},"__esModule",{value:!0}),l);var D={};o(D,{format:()=>u,formatDate:()=>s,formatRange:()=>c,formatTime:()=>f});module.exports=S(D);function f(l,t){return new Intl.DateTimeFormat(t?.locale,{timeStyle:t?.style??"short"}).format(l)}function s(l,t){return new Intl.DateTimeFormat(t?.locale,{dateStyle:t?.style??"medium"}).format(l)}function u(l,t){const e=t?.timeStyle??(t?.style==="tooltip"?"long":t?.style)??"short",m=t?.dateStyle??(t?.style==="tooltip"?"full":t?.style)??"medium";return new Intl.DateTimeFormat(t?.locale,{timeStyle:e,dateStyle:m}).format(l)}function c(l,t,e){const m=e?.timeStyle===null?void 0:e?.timeStyle??e?.style??"short",a=e?.dateStyle===null?void 0:e?.dateStyle??e?.style??"medium";return new Intl.DateTimeFormat(e?.locale,{timeStyle:m,dateStyle:a}).formatRange(l,t)}
1
+ "use strict";var n=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var r=Object.getOwnPropertyNames;var o=Object.prototype.hasOwnProperty;var y=(l,t)=>{for(var e in t)n(l,e,{get:t[e],enumerable:!0})},d=(l,t,e,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let m of r(t))!o.call(l,m)&&m!==e&&n(l,m,{get:()=>t[m],enumerable:!(a=i(t,m))||a.enumerable});return l};var S=l=>d(n({},"__esModule",{value:!0}),l);var c={};y(c,{format:()=>u,formatDate:()=>s,formatRange:()=>D,formatTime:()=>f});module.exports=S(c);function f(l,t){return new Intl.DateTimeFormat(t?.locale,{timeStyle:t?.style??"short",timeZone:t?.timeZone}).format(l)}function s(l,t){return new Intl.DateTimeFormat(t?.locale,{dateStyle:t?.style??"medium",timeZone:t?.timeZone}).format(l)}function u(l,t){const e=t?.timeStyle??(t?.style==="tooltip"?"long":t?.style)??"short",a=t?.dateStyle??(t?.style==="tooltip"?"full":t?.style)??"medium";return new Intl.DateTimeFormat(t?.locale,{timeStyle:e,dateStyle:a,timeZone:t?.timeZone}).format(l)}function D(l,t,e){const a=e?.timeStyle===null?void 0:e?.timeStyle??e?.style??"short",m=e?.dateStyle===null?void 0:e?.dateStyle??e?.style??"medium";return new Intl.DateTimeFormat(e?.locale,{timeStyle:a,dateStyle:m,timeZone:e?.timeZone}).formatRange(l,t)}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/utilities",
3
3
  "description": "Utilities and helpers to drive consistency across software products using the Carbon Design System",
4
- "version": "0.5.1",
4
+ "version": "0.6.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -46,5 +46,5 @@
46
46
  "dependencies": {
47
47
  "@ibm/telemetry-js": "^1.6.1"
48
48
  },
49
- "gitHead": "b57fe786d9a3086249c70a5bb50a835d795cb876"
49
+ "gitHead": "68105b183b14b348bcba4622f86a9e50265414da"
50
50
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2024
2
+ * Copyright IBM Corp. 2024, 2025
3
3
  *
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -7,20 +7,24 @@
7
7
  export declare function formatTime(date: Date | number, options?: Partial<{
8
8
  locale: string;
9
9
  style: Intl.DateTimeFormatOptions['timeStyle'];
10
+ timeZone: Intl.DateTimeFormatOptions['timeZone'];
10
11
  }>): string;
11
12
  export declare function formatDate(date: Date | number, options?: Partial<{
12
13
  locale: string;
13
14
  style: Intl.DateTimeFormatOptions['dateStyle'];
15
+ timeZone: Intl.DateTimeFormatOptions['timeZone'];
14
16
  }>): string;
15
17
  export declare function format(date: Date | number, options?: Partial<{
16
18
  locale: string;
17
19
  style: Intl.DateTimeFormatOptions['timeStyle'] | 'tooltip';
18
20
  timeStyle: Intl.DateTimeFormatOptions['timeStyle'];
19
21
  dateStyle: Intl.DateTimeFormatOptions['dateStyle'];
22
+ timeZone: Intl.DateTimeFormatOptions['timeZone'];
20
23
  }>): string;
21
24
  export declare function formatRange(startDate: Date | number, endDate: Date | number, options?: Partial<{
22
25
  locale: string;
23
26
  style: Intl.DateTimeFormatOptions['timeStyle'];
24
27
  timeStyle: Intl.DateTimeFormatOptions['timeStyle'] | null;
25
28
  dateStyle: Intl.DateTimeFormatOptions['dateStyle'] | null;
29
+ timeZone: Intl.DateTimeFormatOptions['timeZone'];
26
30
  }>): string;