@dereekb/date 9.1.2 → 9.2.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/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ # [9.2.0](https://github.com/dereekb/dbx-components/compare/v9.1.2-dev...v9.2.0) (2022-08-18)
6
+
7
+
8
+ ### Features
9
+
10
+ * added timezonePicker() ([a1b23c0](https://github.com/dereekb/dbx-components/commit/a1b23c03f742b20c3f8b631ee9a17730d16b9335))
11
+
12
+
13
+
5
14
  ## [9.1.2](https://github.com/dereekb/dbx-components/compare/v9.1.1-dev...v9.1.2) (2022-08-16)
6
15
 
7
16
 
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@dereekb/date",
3
- "version": "9.1.2",
3
+ "version": "9.2.0",
4
4
  "type": "commonjs",
5
5
  "main": "./src/index.js",
6
6
  "typings": "./src/index.d.ts",
7
7
  "dependencies": {},
8
8
  "peerDependencies": {
9
9
  "date-fns": "^2.29.0",
10
- "@dereekb/util": "9.1.2",
10
+ "@dereekb/util": "9.2.0",
11
11
  "lodash.isequal": "^4.5.0",
12
12
  "make-error": "^1.3.0",
13
13
  "ts-essentials": "^9.1.2",
@@ -17,6 +17,7 @@
17
17
  "date-fns-tz": "^1.3.0",
18
18
  "rxjs": "^7.5.0",
19
19
  "rrule": "git+https://git@github.com/dereekb/rrule#2b13b1ea881059ba2ecfec380e12ef244ef54570",
20
+ "@vvo/tzdb": "^6.56.0",
20
21
  "tslib": "^2.0.0"
21
22
  }
22
23
  }
@@ -1,3 +1,5 @@
1
1
  export * from './date';
2
2
  export * from './expires';
3
+ export * from './query';
3
4
  export * from './rrule';
5
+ export * from './timezone';
package/src/lib/index.js CHANGED
@@ -3,5 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./date"), exports);
5
5
  tslib_1.__exportStar(require("./expires"), exports);
6
+ tslib_1.__exportStar(require("./query"), exports);
6
7
  tslib_1.__exportStar(require("./rrule"), exports);
8
+ tslib_1.__exportStar(require("./timezone"), exports);
7
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/date/src/lib/index.ts"],"names":[],"mappings":";;;AAAA,iDAAuB;AACvB,oDAA0B;AAC1B,kDAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/date/src/lib/index.ts"],"names":[],"mappings":";;;AAAA,iDAAuB;AACvB,oDAA0B;AAC1B,kDAAwB;AACxB,kDAAwB;AACxB,qDAA2B"}
@@ -0,0 +1 @@
1
+ export * from './timezone';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./timezone"), exports);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/date/src/lib/timezone/index.ts"],"names":[],"mappings":";;;AAAA,qDAA2B"}
@@ -0,0 +1,12 @@
1
+ import { TimezoneString, TimezoneStringRef } from '@dereekb/util';
2
+ export declare function allTimezoneStrings(): TimezoneString[];
3
+ export declare const allTimezoneInfos: import("@dereekb/util").CachedFactoryWithInput<TimezoneInfo[], unknown>;
4
+ export interface TimezoneInfo extends TimezoneStringRef {
5
+ search: string;
6
+ lowercase: string;
7
+ abbreviation: string;
8
+ }
9
+ export declare function timezoneInfoForSystem(): TimezoneInfo;
10
+ export declare function timezoneStringToTimezoneInfo(timezone: TimezoneString): TimezoneInfo;
11
+ export declare function searchTimezoneInfos(search: string, infos: TimezoneInfo[]): TimezoneInfo[];
12
+ export declare function timezoneStringToSearchableString(timezone: TimezoneString): string;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.timezoneStringToSearchableString = exports.searchTimezoneInfos = exports.timezoneStringToTimezoneInfo = exports.timezoneInfoForSystem = exports.allTimezoneInfos = exports.allTimezoneStrings = void 0;
4
+ const util_1 = require("@dereekb/util");
5
+ const date_fns_tz_1 = require("date-fns-tz");
6
+ const tzdb_1 = require("@vvo/tzdb");
7
+ const date_1 = require("../date");
8
+ function allTimezoneStrings() {
9
+ return tzdb_1.timeZonesNames.concat(util_1.UTC_TIMEZONE_STRING);
10
+ }
11
+ exports.allTimezoneStrings = allTimezoneStrings;
12
+ exports.allTimezoneInfos = (0, util_1.cachedGetter)(() => allTimezoneStrings().map(timezoneStringToTimezoneInfo));
13
+ function timezoneInfoForSystem() {
14
+ return timezoneStringToTimezoneInfo((0, date_1.guessCurrentTimezone)());
15
+ }
16
+ exports.timezoneInfoForSystem = timezoneInfoForSystem;
17
+ function timezoneStringToTimezoneInfo(timezone) {
18
+ return {
19
+ timezone,
20
+ search: timezoneStringToSearchableString(timezone),
21
+ lowercase: timezone.toLowerCase(),
22
+ abbreviation: (0, date_fns_tz_1.formatInTimeZone)(new Date(), timezone, 'zzz')
23
+ };
24
+ }
25
+ exports.timezoneStringToTimezoneInfo = timezoneStringToTimezoneInfo;
26
+ function searchTimezoneInfos(search, infos) {
27
+ const searchString = search.toLocaleLowerCase();
28
+ return infos.filter((x) => (search.length > 2 && x.search.includes(searchString)) || x.lowercase.startsWith(searchString) || x.abbreviation.includes(search) || x.search === x.timezone);
29
+ }
30
+ exports.searchTimezoneInfos = searchTimezoneInfos;
31
+ const timezoneStringToSearchableStringReplace = (0, util_1.replaceStringsFunction)({
32
+ replace: ['/', '_'],
33
+ replaceWith: ' '
34
+ });
35
+ function timezoneStringToSearchableString(timezone) {
36
+ return timezoneStringToSearchableStringReplace(timezone.toLocaleLowerCase());
37
+ }
38
+ exports.timezoneStringToSearchableString = timezoneStringToSearchableString;
39
+ //# source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