@escapenavigator/services 1.4.38 → 1.4.39
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/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/serialize-slot.js +10 -1
- package/dist/utils/tz-date.d.ts +9 -0
- package/dist/utils/tz-date.js +17 -0
- package/package.json +5 -3
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./serialize-record"), exports);
|
|
18
18
|
__exportStar(require("./validate-by-dto"), exports);
|
|
19
19
|
__exportStar(require("./get-handled-error-message"), exports);
|
|
20
|
+
__exportStar(require("./tz-date"), exports);
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.serializeSlot = exports.serializeSlotOrderData = void 0;
|
|
4
|
+
var getPayedStatus = function (order) {
|
|
5
|
+
if (!order.payed)
|
|
6
|
+
return 'not_payed';
|
|
7
|
+
if (order.total - order.payed === 0)
|
|
8
|
+
return 'payed';
|
|
9
|
+
if (order.total - order.payed > 0)
|
|
10
|
+
return 'half-payed';
|
|
11
|
+
return 'over-payed';
|
|
12
|
+
};
|
|
4
13
|
var serializeSlotOrderData = function (order) {
|
|
5
14
|
var _a, _b, _c, _d;
|
|
6
15
|
return order && {
|
|
7
16
|
id: order.id,
|
|
8
17
|
players: order.players,
|
|
9
|
-
|
|
18
|
+
status: getPayedStatus(order),
|
|
10
19
|
hasDiscounts: !!((_a = order.discounts) === null || _a === void 0 ? void 0 : _a.length),
|
|
11
20
|
hasCertificateApplies: !!((_b = order.certificates) === null || _b === void 0 ? void 0 : _b.length),
|
|
12
21
|
hasPenalties: !!((_c = order.penalties) === null || _c === void 0 ? void 0 : _c.length),
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare type Props = {
|
|
2
|
+
date: string;
|
|
3
|
+
time: string;
|
|
4
|
+
timezone: 'Europe/Berlin';
|
|
5
|
+
hours: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const convertZonedToUTC: ({ date, time, timezone, hours, }: Props) => string;
|
|
8
|
+
export declare const convertUtcToZoned: ({ date, timezone }: Pick<Props, 'date' | 'timezone'>) => string;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertUtcToZoned = exports.convertZonedToUTC = void 0;
|
|
4
|
+
var date_fns_1 = require("date-fns");
|
|
5
|
+
var date_fns_tz_1 = require("date-fns-tz");
|
|
6
|
+
var convertZonedToUTC = function (_a) {
|
|
7
|
+
var date = _a.date, time = _a.time, timezone = _a.timezone, hours = _a.hours;
|
|
8
|
+
var d = (0, date_fns_tz_1.zonedTimeToUtc)(new Date("".concat(date, "T").concat(time)), timezone);
|
|
9
|
+
var u = (0, date_fns_1.addHours)(d, hours).toISOString();
|
|
10
|
+
return u.split('.')[0];
|
|
11
|
+
};
|
|
12
|
+
exports.convertZonedToUTC = convertZonedToUTC;
|
|
13
|
+
var convertUtcToZoned = function (_a) {
|
|
14
|
+
var date = _a.date, timezone = _a.timezone;
|
|
15
|
+
return (0, date_fns_1.format)((0, date_fns_tz_1.utcToZonedTime)("".concat(date, ".000Z"), timezone), 'dd.MM.yyyy, HH:mm');
|
|
16
|
+
};
|
|
17
|
+
exports.convertUtcToZoned = convertUtcToZoned;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@escapenavigator/services",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.39",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -12,12 +12,14 @@
|
|
|
12
12
|
"scripts": {
|
|
13
13
|
"build": "rm -rf dist && tsc --project tsconfig.json"
|
|
14
14
|
},
|
|
15
|
-
"gitHead": "
|
|
15
|
+
"gitHead": "45a3e9a53b22ee703585c23a3a634ac839d4af9e",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@escapenavigator/types": "^1.4.
|
|
17
|
+
"@escapenavigator/types": "^1.4.39",
|
|
18
18
|
"axios": "^0.21.4",
|
|
19
19
|
"class-transformer": "^0.5.1",
|
|
20
20
|
"class-validator": "^0.13.1",
|
|
21
|
+
"date-fns": "^2.22.1",
|
|
22
|
+
"date-fns-tz": "^2.0.0",
|
|
21
23
|
"i18next": "^21.6.4",
|
|
22
24
|
"react": "^17.0.2",
|
|
23
25
|
"react-dom": "^17.0.2"
|