@juhuu/sdk-ts 1.2.41 → 1.2.42

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/index.d.mts CHANGED
@@ -661,6 +661,10 @@ declare class TariffsService extends Service {
661
661
  */
662
662
  calculateAmount(tariff: JUHUU.Tariff.Object, rentTimeSeconds: number): number;
663
663
  calculateMaximumAmount(tariff: JUHUU.Tariff.Object): number;
664
+ /**
665
+ * Returns a date object containing the timestamp that a session would have to end at if it was created right now
666
+ */
667
+ getEndDate(tariff: JUHUU.Tariff.Object): Date;
664
668
  }
665
669
 
666
670
  declare class ProductService extends Service {
package/dist/index.d.ts CHANGED
@@ -661,6 +661,10 @@ declare class TariffsService extends Service {
661
661
  */
662
662
  calculateAmount(tariff: JUHUU.Tariff.Object, rentTimeSeconds: number): number;
663
663
  calculateMaximumAmount(tariff: JUHUU.Tariff.Object): number;
664
+ /**
665
+ * Returns a date object containing the timestamp that a session would have to end at if it was created right now
666
+ */
667
+ getEndDate(tariff: JUHUU.Tariff.Object): Date;
664
668
  }
665
669
 
666
670
  declare class ProductService extends Service {
package/dist/index.js CHANGED
@@ -1182,6 +1182,17 @@ var TariffsService = class extends Service {
1182
1182
  calculateMaximumAmount(tariff) {
1183
1183
  return this.calculateAmount(tariff, tariff.duration);
1184
1184
  }
1185
+ /**
1186
+ * Returns a date object containing the timestamp that a session would have to end at if it was created right now
1187
+ */
1188
+ getEndDate(tariff) {
1189
+ if (tariff.roundToMidnight === false) {
1190
+ return new Date(Date.now() + tariff.duration * 1e3);
1191
+ }
1192
+ const end = new Date(Date.now() + tariff.duration * 1e3);
1193
+ end.setHours(23, 59, 59, 999);
1194
+ return end;
1195
+ }
1185
1196
  };
1186
1197
 
1187
1198
  // src/products/products.service.ts
package/dist/index.mjs CHANGED
@@ -1137,6 +1137,17 @@ var TariffsService = class extends Service {
1137
1137
  calculateMaximumAmount(tariff) {
1138
1138
  return this.calculateAmount(tariff, tariff.duration);
1139
1139
  }
1140
+ /**
1141
+ * Returns a date object containing the timestamp that a session would have to end at if it was created right now
1142
+ */
1143
+ getEndDate(tariff) {
1144
+ if (tariff.roundToMidnight === false) {
1145
+ return new Date(Date.now() + tariff.duration * 1e3);
1146
+ }
1147
+ const end = new Date(Date.now() + tariff.duration * 1e3);
1148
+ end.setHours(23, 59, 59, 999);
1149
+ return end;
1150
+ }
1140
1151
  };
1141
1152
 
1142
1153
  // src/products/products.service.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juhuu/sdk-ts",
3
- "version": "1.2.41",
3
+ "version": "1.2.42",
4
4
  "description": "Typescript wrapper for JUHUU services",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",