@webority-technologies/mobile-core 0.0.5 → 0.0.6

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.
@@ -3,7 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.startOfDay = exports.isSameDay = exports.isDateBefore = exports.isDateAfter = exports.formatTimeInZone = exports.formatTime12h = exports.formatDatePattern = exports.formatDateISO = exports.formatDateDDMMMYYYY = exports.diffMs = exports.addDays = void 0;
6
+ exports.startOfDay = exports.isSameDay = exports.isDateBefore = exports.isDateAfter = exports.formatTimeInZone = exports.formatTimeInWindowsZone = exports.formatTime12h = exports.formatDatePattern = exports.formatDateISO = exports.formatDateDDMMMYYYY = exports.diffMs = exports.addDays = void 0;
7
+ var _windowsIana = require("windows-iana");
7
8
  const toDate = value => {
8
9
  if (value instanceof Date) {
9
10
  return Number.isNaN(value.getTime()) ? null : value;
@@ -288,5 +289,22 @@ const formatTimeInZone = (value, ianaTimeZone) => {
288
289
  const period = get('dayPeriod').toLowerCase();
289
290
  return `${PAD(hour)}:${minute} ${period}`;
290
291
  };
292
+
293
+ /**
294
+ * Same as {@link formatTimeInZone}, but for a .NET-style Windows timezone ID
295
+ * (e.g. `"India Standard Time"`) rather than an IANA one. .NET's own
296
+ * `TimeZoneInfo` API only knows Windows IDs, so a backend built on it hands
297
+ * these to clients directly — `Intl`, by contrast, only recognises IANA
298
+ * names, so the ID has to be translated before it can be used here. Throws
299
+ * if `windowsTimeZoneId` has no known IANA mapping.
300
+ */
291
301
  exports.formatTimeInZone = formatTimeInZone;
302
+ const formatTimeInWindowsZone = (value, windowsTimeZoneId) => {
303
+ const ianaTimeZones = (0, _windowsIana.findIana)(windowsTimeZoneId);
304
+ if (!ianaTimeZones || ianaTimeZones.length === 0) {
305
+ throw new Error(`Mapping for Windows time zone '${windowsTimeZoneId}' not found.`);
306
+ }
307
+ return formatTimeInZone(value, ianaTimeZones[0]);
308
+ };
309
+ exports.formatTimeInWindowsZone = formatTimeInWindowsZone;
292
310
  //# sourceMappingURL=dateMath.js.map
@@ -99,6 +99,12 @@ Object.defineProperty(exports, "formatTime12h", {
99
99
  return _dateMath.formatTime12h;
100
100
  }
101
101
  });
102
+ Object.defineProperty(exports, "formatTimeInWindowsZone", {
103
+ enumerable: true,
104
+ get: function () {
105
+ return _dateMath.formatTimeInWindowsZone;
106
+ }
107
+ });
102
108
  Object.defineProperty(exports, "formatTimeInZone", {
103
109
  enumerable: true,
104
110
  get: function () {
@@ -177,6 +177,12 @@ Object.defineProperty(exports, "formatTime12h", {
177
177
  return _index3.formatTime12h;
178
178
  }
179
179
  });
180
+ Object.defineProperty(exports, "formatTimeInWindowsZone", {
181
+ enumerable: true,
182
+ get: function () {
183
+ return _index3.formatTimeInWindowsZone;
184
+ }
185
+ });
180
186
  Object.defineProperty(exports, "formatTimeInZone", {
181
187
  enumerable: true,
182
188
  get: function () {
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ import { findIana } from 'windows-iana';
3
4
  const toDate = value => {
4
5
  if (value instanceof Date) {
5
6
  return Number.isNaN(value.getTime()) ? null : value;
@@ -274,4 +275,20 @@ export const formatTimeInZone = (value, ianaTimeZone) => {
274
275
  const period = get('dayPeriod').toLowerCase();
275
276
  return `${PAD(hour)}:${minute} ${period}`;
276
277
  };
278
+
279
+ /**
280
+ * Same as {@link formatTimeInZone}, but for a .NET-style Windows timezone ID
281
+ * (e.g. `"India Standard Time"`) rather than an IANA one. .NET's own
282
+ * `TimeZoneInfo` API only knows Windows IDs, so a backend built on it hands
283
+ * these to clients directly — `Intl`, by contrast, only recognises IANA
284
+ * names, so the ID has to be translated before it can be used here. Throws
285
+ * if `windowsTimeZoneId` has no known IANA mapping.
286
+ */
287
+ export const formatTimeInWindowsZone = (value, windowsTimeZoneId) => {
288
+ const ianaTimeZones = findIana(windowsTimeZoneId);
289
+ if (!ianaTimeZones || ianaTimeZones.length === 0) {
290
+ throw new Error(`Mapping for Windows time zone '${windowsTimeZoneId}' not found.`);
291
+ }
292
+ return formatTimeInZone(value, ianaTimeZones[0]);
293
+ };
277
294
  //# sourceMappingURL=dateMath.js.map
@@ -2,7 +2,7 @@
2
2
 
3
3
  export { formatCurrency } from "./currency.js";
4
4
  export { formatDate, formatDateTime, formatRelativeTime, formatTime } from "./date.js";
5
- export { addDays, diffMs, formatDateDDMMMYYYY, formatDateISO, formatDatePattern, formatTime12h, formatTimeInZone, isDateAfter, isDateBefore, isSameDay, startOfDay } from "./dateMath.js";
5
+ export { addDays, diffMs, formatDateDDMMMYYYY, formatDateISO, formatDatePattern, formatTime12h, formatTimeInWindowsZone, formatTimeInZone, isDateAfter, isDateBefore, isSameDay, startOfDay } from "./dateMath.js";
6
6
  export { getInitials } from "./initials.js";
7
7
  export { formatCompactNumber, formatNumber, formatPercent } from "./number.js";
8
8
  export { detectPhoneCountry, formatPhone, isValidPhoneNumber, normalizePhone, parsePhoneNumber, parsePhoneNumberFromString } from "./phone.js";
@@ -29,7 +29,7 @@ export { getConfig, getConfigValue, resetConfig, setConfig } from "./config/inde
29
29
  // Deep links
30
30
  export { DeepLink, parseDeepLink, useDeepLink } from "./deepLink/index.js";
31
31
  // Formatters
32
- export { addDays, detectPhoneCountry, diffMs, formatCompactNumber, formatCurrency, formatDate, formatDateDDMMMYYYY, formatDateISO, formatDatePattern, formatDateTime, formatNumber, formatPercent, formatPhone, formatRelativeTime, formatTime, formatTime12h, formatTimeInZone, getInitials, isDateAfter, isDateBefore, isSameDay, isValidPhoneNumber, normalizePhone, parsePhoneNumber, parsePhoneNumberFromString, startOfDay } from "./formatters/index.js";
32
+ export { addDays, detectPhoneCountry, diffMs, formatCompactNumber, formatCurrency, formatDate, formatDateDDMMMYYYY, formatDateISO, formatDatePattern, formatDateTime, formatNumber, formatPercent, formatPhone, formatRelativeTime, formatTime, formatTime12h, formatTimeInWindowsZone, formatTimeInZone, getInitials, isDateAfter, isDateBefore, isSameDay, isValidPhoneNumber, normalizePhone, parsePhoneNumber, parsePhoneNumberFromString, startOfDay } from "./formatters/index.js";
33
33
  // Initialization
34
34
  export { initWebority } from "./initSDK.js";
35
35
  export { initUserAuth } from "./initUserAuth.js";
@@ -76,4 +76,13 @@ export declare const formatTime12h: (value: DateInput) => string;
76
76
  * recognises — the same failure mode as handing dayjs.tz() a bad zone name.
77
77
  */
78
78
  export declare const formatTimeInZone: (value: DateInput, ianaTimeZone: string) => string;
79
+ /**
80
+ * Same as {@link formatTimeInZone}, but for a .NET-style Windows timezone ID
81
+ * (e.g. `"India Standard Time"`) rather than an IANA one. .NET's own
82
+ * `TimeZoneInfo` API only knows Windows IDs, so a backend built on it hands
83
+ * these to clients directly — `Intl`, by contrast, only recognises IANA
84
+ * names, so the ID has to be translated before it can be used here. Throws
85
+ * if `windowsTimeZoneId` has no known IANA mapping.
86
+ */
87
+ export declare const formatTimeInWindowsZone: (value: DateInput, windowsTimeZoneId: string) => string;
79
88
  //# sourceMappingURL=dateMath.d.ts.map
@@ -2,7 +2,7 @@ export type { FormatCurrencyOptions } from './currency';
2
2
  export { formatCurrency } from './currency';
3
3
  export type { DateInput, DateStyle, TimeStyle } from './date';
4
4
  export { formatDate, formatDateTime, formatRelativeTime, formatTime } from './date';
5
- export { addDays, diffMs, formatDateDDMMMYYYY, formatDateISO, formatDatePattern, formatTime12h, formatTimeInZone, isDateAfter, isDateBefore, isSameDay, startOfDay } from './dateMath';
5
+ export { addDays, diffMs, formatDateDDMMMYYYY, formatDateISO, formatDatePattern, formatTime12h, formatTimeInWindowsZone, formatTimeInZone, isDateAfter, isDateBefore, isSameDay, startOfDay } from './dateMath';
6
6
  export { getInitials } from './initials';
7
7
  export { formatCompactNumber, formatNumber, formatPercent } from './number';
8
8
  export type { FormatPhoneOptions, PhoneCountry, PhoneNumber } from './phone';
@@ -29,7 +29,7 @@ export { getConfig, getConfigValue, resetConfig, setConfig } from './config';
29
29
  export type { DeepLinkConfig, DeepLinkRoute, ParsedLink } from './deepLink';
30
30
  export { DeepLink, parseDeepLink, useDeepLink } from './deepLink';
31
31
  export type { DateInput, DateStyle, FormatCurrencyOptions, FormatPhoneOptions, PhoneCountry, PhoneNumber, TimeStyle } from './formatters';
32
- export { addDays, detectPhoneCountry, diffMs, formatCompactNumber, formatCurrency, formatDate, formatDateDDMMMYYYY, formatDateISO, formatDatePattern, formatDateTime, formatNumber, formatPercent, formatPhone, formatRelativeTime, formatTime, formatTime12h, formatTimeInZone, getInitials, isDateAfter, isDateBefore, isSameDay, isValidPhoneNumber, normalizePhone, parsePhoneNumber, parsePhoneNumberFromString, startOfDay } from './formatters';
32
+ export { addDays, detectPhoneCountry, diffMs, formatCompactNumber, formatCurrency, formatDate, formatDateDDMMMYYYY, formatDateISO, formatDatePattern, formatDateTime, formatNumber, formatPercent, formatPhone, formatRelativeTime, formatTime, formatTime12h, formatTimeInWindowsZone, formatTimeInZone, getInitials, isDateAfter, isDateBefore, isSameDay, isValidPhoneNumber, normalizePhone, parsePhoneNumber, parsePhoneNumberFromString, startOfDay } from './formatters';
33
33
  export type { InitConfig } from './initSDK';
34
34
  export { initWebority } from './initSDK';
35
35
  export type { AuthActions } from './initUserAuth';
@@ -76,4 +76,13 @@ export declare const formatTime12h: (value: DateInput) => string;
76
76
  * recognises — the same failure mode as handing dayjs.tz() a bad zone name.
77
77
  */
78
78
  export declare const formatTimeInZone: (value: DateInput, ianaTimeZone: string) => string;
79
+ /**
80
+ * Same as {@link formatTimeInZone}, but for a .NET-style Windows timezone ID
81
+ * (e.g. `"India Standard Time"`) rather than an IANA one. .NET's own
82
+ * `TimeZoneInfo` API only knows Windows IDs, so a backend built on it hands
83
+ * these to clients directly — `Intl`, by contrast, only recognises IANA
84
+ * names, so the ID has to be translated before it can be used here. Throws
85
+ * if `windowsTimeZoneId` has no known IANA mapping.
86
+ */
87
+ export declare const formatTimeInWindowsZone: (value: DateInput, windowsTimeZoneId: string) => string;
79
88
  //# sourceMappingURL=dateMath.d.ts.map
@@ -2,7 +2,7 @@ export type { FormatCurrencyOptions } from './currency.js';
2
2
  export { formatCurrency } from './currency.js';
3
3
  export type { DateInput, DateStyle, TimeStyle } from './date.js';
4
4
  export { formatDate, formatDateTime, formatRelativeTime, formatTime } from './date.js';
5
- export { addDays, diffMs, formatDateDDMMMYYYY, formatDateISO, formatDatePattern, formatTime12h, formatTimeInZone, isDateAfter, isDateBefore, isSameDay, startOfDay } from './dateMath.js';
5
+ export { addDays, diffMs, formatDateDDMMMYYYY, formatDateISO, formatDatePattern, formatTime12h, formatTimeInWindowsZone, formatTimeInZone, isDateAfter, isDateBefore, isSameDay, startOfDay } from './dateMath.js';
6
6
  export { getInitials } from './initials.js';
7
7
  export { formatCompactNumber, formatNumber, formatPercent } from './number.js';
8
8
  export type { FormatPhoneOptions, PhoneCountry, PhoneNumber } from './phone.js';
@@ -29,7 +29,7 @@ export { getConfig, getConfigValue, resetConfig, setConfig } from './config/inde
29
29
  export type { DeepLinkConfig, DeepLinkRoute, ParsedLink } from './deepLink/index.js';
30
30
  export { DeepLink, parseDeepLink, useDeepLink } from './deepLink/index.js';
31
31
  export type { DateInput, DateStyle, FormatCurrencyOptions, FormatPhoneOptions, PhoneCountry, PhoneNumber, TimeStyle } from './formatters/index.js';
32
- export { addDays, detectPhoneCountry, diffMs, formatCompactNumber, formatCurrency, formatDate, formatDateDDMMMYYYY, formatDateISO, formatDatePattern, formatDateTime, formatNumber, formatPercent, formatPhone, formatRelativeTime, formatTime, formatTime12h, formatTimeInZone, getInitials, isDateAfter, isDateBefore, isSameDay, isValidPhoneNumber, normalizePhone, parsePhoneNumber, parsePhoneNumberFromString, startOfDay } from './formatters/index.js';
32
+ export { addDays, detectPhoneCountry, diffMs, formatCompactNumber, formatCurrency, formatDate, formatDateDDMMMYYYY, formatDateISO, formatDatePattern, formatDateTime, formatNumber, formatPercent, formatPhone, formatRelativeTime, formatTime, formatTime12h, formatTimeInWindowsZone, formatTimeInZone, getInitials, isDateAfter, isDateBefore, isSameDay, isValidPhoneNumber, normalizePhone, parsePhoneNumber, parsePhoneNumberFromString, startOfDay } from './formatters/index.js';
33
33
  export type { InitConfig } from './initSDK.js';
34
34
  export { initWebority } from './initSDK.js';
35
35
  export type { AuthActions } from './initUserAuth.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority-technologies/mobile-core",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "Platform layer for Webority React Native apps: HTTP clients, auth/token storage, config, logging, formatters, validators, network status, permissions, storage and version checks. No UI.",
5
5
  "keywords": [
6
6
  "react-native",
@@ -134,7 +134,8 @@
134
134
  },
135
135
  "dependencies": {
136
136
  "axios": "^1.19.0",
137
- "libphonenumber-js": "^1.12.41"
137
+ "libphonenumber-js": "^1.12.41",
138
+ "windows-iana": "^5.1.0"
138
139
  },
139
140
  "peerDependencies": {
140
141
  "@op-engineering/op-sqlite": "*",