@pushwoosh/dumb-components 1.1.238 → 2.1.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.
@@ -4,21 +4,21 @@ const melbourneDst = new Date('2026-10-10T12:00:00Z');
4
4
  const melbourneStandard = new Date('2026-06-15T12:00:00Z');
5
5
  describe('formatTimezoneOffset', () => {
6
6
  it('renders sign, hours and minutes', () => {
7
- expect(formatTimezoneOffset(300)).toBe('GMT+05:00');
8
- expect(formatTimezoneOffset(330)).toBe('GMT+05:30');
9
- expect(formatTimezoneOffset(-210)).toBe('GMT-03:30');
10
- expect(formatTimezoneOffset(0)).toBe('GMT+00:00');
7
+ expect(formatTimezoneOffset(300)).toBe('UTC+05:00');
8
+ expect(formatTimezoneOffset(330)).toBe('UTC+05:30');
9
+ expect(formatTimezoneOffset(-210)).toBe('UTC-03:30');
10
+ expect(formatTimezoneOffset(0)).toBe('UTC+00:00');
11
11
  });
12
12
  });
13
13
  describe('formatTimezoneShort', () => {
14
14
  it('renders the bare offset the calendar badge shows', () => {
15
- expect(formatTimezoneShort('Asia/Almaty', winter)).toBe('GMT+05:00');
16
- expect(formatTimezoneShort('Asia/Kolkata', winter)).toBe('GMT+05:30');
17
- expect(formatTimezoneShort('UTC', winter)).toBe('GMT+00:00');
15
+ expect(formatTimezoneShort('Asia/Almaty', winter)).toBe('UTC+05:00');
16
+ expect(formatTimezoneShort('Asia/Kolkata', winter)).toBe('UTC+05:30');
17
+ expect(formatTimezoneShort('UTC', winter)).toBe('UTC+00:00');
18
18
  });
19
19
  it('follows DST at the given instant', () => {
20
- expect(formatTimezoneShort('Australia/Melbourne', melbourneStandard)).toBe('GMT+10:00');
21
- expect(formatTimezoneShort('Australia/Melbourne', melbourneDst)).toBe('GMT+11:00');
20
+ expect(formatTimezoneShort('Australia/Melbourne', melbourneStandard)).toBe('UTC+10:00');
21
+ expect(formatTimezoneShort('Australia/Melbourne', melbourneDst)).toBe('UTC+11:00');
22
22
  });
23
23
  it('keeps an unknown zone readable', () => {
24
24
  expect(formatTimezoneShort('Not/AZone', winter)).toBe('Not/AZone');
@@ -26,13 +26,13 @@ describe('formatTimezoneShort', () => {
26
26
  });
27
27
  describe('formatTimezoneLabel', () => {
28
28
  it('uses the current tzdata: Kazakhstan is UTC+5 since 2024', () => {
29
- expect(formatTimezoneLabel('Asia/Almaty', winter)).toBe('(GMT+05:00) Asia/Almaty');
30
- expect(formatTimezoneLabel('Asia/Qostanay', winter)).toBe('(GMT+05:00) Asia/Qostanay');
29
+ expect(formatTimezoneLabel('Asia/Almaty', winter)).toBe('(UTC+05:00) Asia/Almaty');
30
+ expect(formatTimezoneLabel('Asia/Qostanay', winter)).toBe('(UTC+05:00) Asia/Qostanay');
31
31
  });
32
32
  it('keeps half-hour zones east of UTC exact', () => {
33
- expect(formatTimezoneLabel('Asia/Kolkata', winter)).toBe('(GMT+05:30) Asia/Kolkata');
34
- expect(formatTimezoneLabel('Asia/Kathmandu', winter)).toBe('(GMT+05:45) Asia/Kathmandu');
35
- expect(formatTimezoneLabel('America/St_Johns', winter)).toBe('(GMT-03:30) America/St_Johns');
33
+ expect(formatTimezoneLabel('Asia/Kolkata', winter)).toBe('(UTC+05:30) Asia/Kolkata');
34
+ expect(formatTimezoneLabel('Asia/Kathmandu', winter)).toBe('(UTC+05:45) Asia/Kathmandu');
35
+ expect(formatTimezoneLabel('America/St_Johns', winter)).toBe('(UTC-03:30) America/St_Johns');
36
36
  });
37
37
  it('resolves the offset at the given instant, not today', () => {
38
38
  expect(getTimezoneOffsetSafe('Australia/Melbourne', winter)).toBe(660);
@@ -40,9 +40,9 @@ describe('formatTimezoneLabel', () => {
40
40
  expect(getTimezoneOffsetSafe('Australia/Melbourne', melbourneDst)).toBe(660);
41
41
  });
42
42
  it('labels Etc and POSIX names the backend accepts but the picker does not list', () => {
43
- expect(formatTimezoneLabel('Etc/GMT+3', winter)).toBe('(GMT-03:00) Etc/GMT+3');
44
- expect(formatTimezoneLabel('Etc/GMT-0', winter)).toBe('(GMT+00:00) Etc/GMT-0');
45
- expect(formatTimezoneLabel('EST', winter)).toBe('(GMT-05:00) EST');
43
+ expect(formatTimezoneLabel('Etc/GMT+3', winter)).toBe('(UTC-03:00) Etc/GMT+3');
44
+ expect(formatTimezoneLabel('Etc/GMT-0', winter)).toBe('(UTC+00:00) Etc/GMT-0');
45
+ expect(formatTimezoneLabel('EST', winter)).toBe('(UTC-05:00) EST');
46
46
  });
47
47
  it('falls back to the bare name for a zone the engine does not know', () => {
48
48
  expect(getTimezoneOffsetSafe('Not/A_Zone')).toBeNull();
@@ -130,7 +130,7 @@ describe('resolveTimezoneOption', () => {
130
130
  it('never rewrites the stored value', () => {
131
131
  expect(resolveTimezoneOption('Europe/Kiev', winter)).toEqual({
132
132
  value: 'Europe/Kiev',
133
- label: '(GMT+02:00) Europe/Kiev'
133
+ label: '(UTC+02:00) Europe/Kiev'
134
134
  });
135
135
  expect(resolveTimezoneOption('Not/A_Zone', winter)).toEqual({
136
136
  value: 'Not/A_Zone',
@@ -9,11 +9,11 @@ export declare function getBrowserTimezone(): string;
9
9
  export declare function canonicalizeTimezone(timezone: string): string | null;
10
10
  /** Offset of `timezone` in minutes east of UTC at instant `at`, or `null` for a zone the engine doesn't know. */
11
11
  export declare function getTimezoneOffsetSafe(timezone: string, at?: Date): number | null;
12
- /** Minutes east of UTC rendered as `GMT+05:00` / `GMT-03:30`. */
12
+ /** Minutes east of UTC rendered as `UTC+05:00` / `UTC-03:30`. */
13
13
  export declare function formatTimezoneOffset(minutes: number): string;
14
- /** The shared picker label, `(GMT+05:00) Asia/Almaty` at instant `at`; a zone the engine doesn't know is labelled by its bare name. */
14
+ /** The shared picker label, `(UTC+05:00) Asia/Almaty` at instant `at`; a zone the engine doesn't know is labelled by its bare name. */
15
15
  export declare function formatTimezoneLabel(timezone: string, at?: Date): string;
16
- /** Compact badge for a zone, `GMT+05:00`; a zone the engine doesn't know is shown by its bare name. */
16
+ /** Compact badge for a zone, `UTC+05:00`; a zone the engine doesn't know is shown by its bare name. */
17
17
  export declare function formatTimezoneShort(timezone: string, at?: Date): string;
18
18
  /** Option for any stored zone name — aliases, `Etc/GMT±N`, POSIX abbreviations — kept verbatim as the value. */
19
19
  export declare function resolveTimezoneOption(timezone: string, at?: Date): TimezoneOption;
@@ -22,20 +22,20 @@ export function getTimezoneOffsetSafe(timezone, at = new Date()) {
22
22
  return null;
23
23
  }
24
24
  }
25
- /** Minutes east of UTC rendered as `GMT+05:00` / `GMT-03:30`. */
25
+ /** Minutes east of UTC rendered as `UTC+05:00` / `UTC-03:30`. */
26
26
  export function formatTimezoneOffset(minutes) {
27
27
  const sign = minutes < 0 ? '-' : '+';
28
28
  const absolute = Math.abs(minutes);
29
29
  const hours = String(Math.floor(absolute / 60)).padStart(2, '0');
30
30
  const mins = String(absolute % 60).padStart(2, '0');
31
- return `GMT${sign}${hours}:${mins}`;
31
+ return `UTC${sign}${hours}:${mins}`;
32
32
  }
33
- /** The shared picker label, `(GMT+05:00) Asia/Almaty` at instant `at`; a zone the engine doesn't know is labelled by its bare name. */
33
+ /** The shared picker label, `(UTC+05:00) Asia/Almaty` at instant `at`; a zone the engine doesn't know is labelled by its bare name. */
34
34
  export function formatTimezoneLabel(timezone, at = new Date()) {
35
35
  const offset = getTimezoneOffsetSafe(timezone, at);
36
36
  return offset === null ? timezone : `(${formatTimezoneOffset(offset)}) ${timezone}`;
37
37
  }
38
- /** Compact badge for a zone, `GMT+05:00`; a zone the engine doesn't know is shown by its bare name. */
38
+ /** Compact badge for a zone, `UTC+05:00`; a zone the engine doesn't know is shown by its bare name. */
39
39
  export function formatTimezoneShort(timezone, at = new Date()) {
40
40
  const offset = getTimezoneOffsetSafe(timezone, at);
41
41
  return offset === null ? timezone : formatTimezoneOffset(offset);
package/index.d.ts CHANGED
@@ -59,4 +59,4 @@ export { ApplicationPreloader, type ApplicationPreloaderProps, } from './Applica
59
59
  export { NotificationInbox, NotificationBar, NotificationBell, type Notification, type NotificationInboxProps, type NotificationSeverity, type NotificationBarType, type NotificationBarProps, type NotificationBellProps, } from './NotificationInbox';
60
60
  export { LeafletTheme } from './LeafletTheme';
61
61
  export { buildBarcodeUrl, barcodePlaceholderSafeEscape, isBarcodePlaceholder, type BarcodeSymbology, type BarcodeUrlParams, } from './helpers/barcodeUrl';
62
- export { canonicalizeTimezone, findTimezoneOption, formatTimezoneLabel, formatTimezoneOffset, getBrowserTimezone, getTimezoneOffsetSafe, listTimezones, resolveTimezoneOption, type TimezoneOption, } from './helpers/timezones';
62
+ export { canonicalizeTimezone, findTimezoneOption, formatTimezoneLabel, formatTimezoneOffset, formatTimezoneShort, getBrowserTimezone, getTimezoneOffsetSafe, listTimezones, resolveTimezoneOption, type TimezoneOption, } from './helpers/timezones';
package/index.js CHANGED
@@ -57,4 +57,4 @@ export { ApplicationPreloader } from './ApplicationPreloader';
57
57
  export { NotificationInbox, NotificationBar, NotificationBell } from './NotificationInbox';
58
58
  export { LeafletTheme } from './LeafletTheme';
59
59
  export { buildBarcodeUrl, barcodePlaceholderSafeEscape, isBarcodePlaceholder } from './helpers/barcodeUrl';
60
- export { canonicalizeTimezone, findTimezoneOption, formatTimezoneLabel, formatTimezoneOffset, getBrowserTimezone, getTimezoneOffsetSafe, listTimezones, resolveTimezoneOption } from './helpers/timezones';
60
+ export { canonicalizeTimezone, findTimezoneOption, formatTimezoneLabel, formatTimezoneOffset, formatTimezoneShort, getBrowserTimezone, getTimezoneOffsetSafe, listTimezones, resolveTimezoneOption } from './helpers/timezones';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/dumb-components",
3
- "version": "1.1.238",
3
+ "version": "2.1.0",
4
4
  "description": "React components to build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",