@formatjs/utils 1.6.3 → 1.7.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.
- package/index.d.ts +1 -0
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/src/defaultTimezone.d.ts +12 -0
- package/lib/src/defaultTimezone.js +29 -0
- package/lib/src/defaultTimezone.js.map +1 -0
- package/package.json +1 -1
- package/src/defaultTimezone.d.ts +12 -0
- package/src/defaultTimezone.js +33 -0
- package/src/defaultTimezone.js.map +1 -0
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultLocale = exports.defaultCurrency = exports.countriesUsingDefaultCurrency = exports.canonicalizeCountryCode = void 0;
|
|
3
|
+
exports.defaultTimezone = exports.defaultLocale = exports.defaultCurrency = exports.countriesUsingDefaultCurrency = exports.canonicalizeCountryCode = void 0;
|
|
4
4
|
var countryCodes_1 = require("./src/countryCodes");
|
|
5
5
|
Object.defineProperty(exports, "canonicalizeCountryCode", { enumerable: true, get: function () { return countryCodes_1.canonicalizeCountryCode; } });
|
|
6
6
|
var defaultCurrency_1 = require("./src/defaultCurrency");
|
|
@@ -8,4 +8,6 @@ Object.defineProperty(exports, "countriesUsingDefaultCurrency", { enumerable: tr
|
|
|
8
8
|
Object.defineProperty(exports, "defaultCurrency", { enumerable: true, get: function () { return defaultCurrency_1.defaultCurrency; } });
|
|
9
9
|
var defaultLocale_1 = require("./src/defaultLocale");
|
|
10
10
|
Object.defineProperty(exports, "defaultLocale", { enumerable: true, get: function () { return defaultLocale_1.defaultLocale; } });
|
|
11
|
+
var defaultTimezone_1 = require("./src/defaultTimezone");
|
|
12
|
+
Object.defineProperty(exports, "defaultTimezone", { enumerable: true, get: function () { return defaultTimezone_1.defaultTimezone; } });
|
|
11
13
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAAA,mDAA0D;AAAlD,uHAAA,uBAAuB,OAAA;AAC/B,yDAG8B;AAF5B,gIAAA,6BAA6B,OAAA;AAC7B,kHAAA,eAAe,OAAA;AAEjB,qDAAiD;AAAzC,8GAAA,aAAa,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAAA,mDAA0D;AAAlD,uHAAA,uBAAuB,OAAA;AAC/B,yDAG8B;AAF5B,gIAAA,6BAA6B,OAAA;AAC7B,kHAAA,eAAe,OAAA;AAEjB,qDAAiD;AAAzC,8GAAA,aAAa,OAAA;AACrB,yDAAqD;AAA7C,kHAAA,eAAe,OAAA"}
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { canonicalizeCountryCode } from './src/countryCodes';
|
|
2
2
|
export { countriesUsingDefaultCurrency, defaultCurrency, } from './src/defaultCurrency';
|
|
3
3
|
export { defaultLocale } from './src/defaultLocale';
|
|
4
|
+
export { defaultTimezone } from './src/defaultTimezone';
|
|
4
5
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,uBAAuB,EAAC,MAAM,oBAAoB,CAAA;AAC1D,OAAO,EACL,6BAA6B,EAC7B,eAAe,GAChB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,uBAAuB,EAAC,MAAM,oBAAoB,CAAA;AAC1D,OAAO,EACL,6BAA6B,EAC7B,eAAe,GAChB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Return the default timezone for the system.
|
|
3
|
+
* @param dateDateTimeFormatCreator creator fn for Intl.DateTimeFormat
|
|
4
|
+
* @returns default timezone for the system
|
|
5
|
+
*/
|
|
6
|
+
export declare function defaultTimezone(dateDateTimeFormatCreator?: () => Intl.DateTimeFormat): string;
|
|
7
|
+
/**
|
|
8
|
+
* Reset the default timezone.
|
|
9
|
+
* Only for testing purposes.
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
12
|
+
export declare function _resetDefaultTimezone(): void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var DEFAULT_TIMEZONE;
|
|
2
|
+
var DEFAULT_DATETIMEFORMAT_CREATOR = function () { return new Intl.DateTimeFormat(); };
|
|
3
|
+
/**
|
|
4
|
+
* Return the default timezone for the system.
|
|
5
|
+
* @param dateDateTimeFormatCreator creator fn for Intl.DateTimeFormat
|
|
6
|
+
* @returns default timezone for the system
|
|
7
|
+
*/
|
|
8
|
+
export function defaultTimezone(dateDateTimeFormatCreator) {
|
|
9
|
+
if (dateDateTimeFormatCreator === void 0) { dateDateTimeFormatCreator = DEFAULT_DATETIMEFORMAT_CREATOR; }
|
|
10
|
+
if (DEFAULT_TIMEZONE) {
|
|
11
|
+
return DEFAULT_TIMEZONE;
|
|
12
|
+
}
|
|
13
|
+
try {
|
|
14
|
+
return (DEFAULT_TIMEZONE =
|
|
15
|
+
dateDateTimeFormatCreator().resolvedOptions().timeZone);
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
return 'UTC';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Reset the default timezone.
|
|
23
|
+
* Only for testing purposes.
|
|
24
|
+
* @private
|
|
25
|
+
*/
|
|
26
|
+
export function _resetDefaultTimezone() {
|
|
27
|
+
DEFAULT_TIMEZONE = undefined;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=defaultTimezone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultTimezone.js","sourceRoot":"","sources":["../../src/defaultTimezone.ts"],"names":[],"mappings":"AAAA,IAAI,gBAAoC,CAAA;AAExC,IAAM,8BAA8B,GAAG,cAAM,OAAA,IAAI,IAAI,CAAC,cAAc,EAAE,EAAzB,CAAyB,CAAA;AAEtE;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAC7B,yBAA0D;IAA1D,0CAAA,EAAA,0DAA0D;IAE1D,IAAI,gBAAgB,EAAE,CAAC;QACrB,OAAO,gBAAgB,CAAA;IACzB,CAAC;IACD,IAAI,CAAC;QACH,OAAO,CAAC,gBAAgB;YACtB,yBAAyB,EAAE,CAAC,eAAe,EAAE,CAAC,QAAQ,CAAC,CAAA;IAC3D,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB;IACnC,gBAAgB,GAAG,SAAS,CAAA;AAC9B,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Return the default timezone for the system.
|
|
3
|
+
* @param dateDateTimeFormatCreator creator fn for Intl.DateTimeFormat
|
|
4
|
+
* @returns default timezone for the system
|
|
5
|
+
*/
|
|
6
|
+
export declare function defaultTimezone(dateDateTimeFormatCreator?: () => Intl.DateTimeFormat): string;
|
|
7
|
+
/**
|
|
8
|
+
* Reset the default timezone.
|
|
9
|
+
* Only for testing purposes.
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
12
|
+
export declare function _resetDefaultTimezone(): void;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defaultTimezone = defaultTimezone;
|
|
4
|
+
exports._resetDefaultTimezone = _resetDefaultTimezone;
|
|
5
|
+
var DEFAULT_TIMEZONE;
|
|
6
|
+
var DEFAULT_DATETIMEFORMAT_CREATOR = function () { return new Intl.DateTimeFormat(); };
|
|
7
|
+
/**
|
|
8
|
+
* Return the default timezone for the system.
|
|
9
|
+
* @param dateDateTimeFormatCreator creator fn for Intl.DateTimeFormat
|
|
10
|
+
* @returns default timezone for the system
|
|
11
|
+
*/
|
|
12
|
+
function defaultTimezone(dateDateTimeFormatCreator) {
|
|
13
|
+
if (dateDateTimeFormatCreator === void 0) { dateDateTimeFormatCreator = DEFAULT_DATETIMEFORMAT_CREATOR; }
|
|
14
|
+
if (DEFAULT_TIMEZONE) {
|
|
15
|
+
return DEFAULT_TIMEZONE;
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
return (DEFAULT_TIMEZONE =
|
|
19
|
+
dateDateTimeFormatCreator().resolvedOptions().timeZone);
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
return 'UTC';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Reset the default timezone.
|
|
27
|
+
* Only for testing purposes.
|
|
28
|
+
* @private
|
|
29
|
+
*/
|
|
30
|
+
function _resetDefaultTimezone() {
|
|
31
|
+
DEFAULT_TIMEZONE = undefined;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=defaultTimezone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultTimezone.js","sourceRoot":"","sources":["defaultTimezone.ts"],"names":[],"mappings":";;AASA,0CAYC;AAOD,sDAEC;AA9BD,IAAI,gBAAoC,CAAA;AAExC,IAAM,8BAA8B,GAAG,cAAM,OAAA,IAAI,IAAI,CAAC,cAAc,EAAE,EAAzB,CAAyB,CAAA;AAEtE;;;;GAIG;AACH,SAAgB,eAAe,CAC7B,yBAA0D;IAA1D,0CAAA,EAAA,0DAA0D;IAE1D,IAAI,gBAAgB,EAAE,CAAC;QACrB,OAAO,gBAAgB,CAAA;IACzB,CAAC;IACD,IAAI,CAAC;QACH,OAAO,CAAC,gBAAgB;YACtB,yBAAyB,EAAE,CAAC,eAAe,EAAE,CAAC,QAAQ,CAAC,CAAA;IAC3D,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,SAAgB,qBAAqB;IACnC,gBAAgB,GAAG,SAAS,CAAA;AAC9B,CAAC"}
|