heartraite 1.0.82 → 1.0.84

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.
@@ -0,0 +1,4 @@
1
+ export declare enum Environment {
2
+ PROD = "prod",
3
+ STAGING = "staging"
4
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Environment = void 0;
4
+ var Environment;
5
+ (function (Environment) {
6
+ Environment["PROD"] = "prod";
7
+ Environment["STAGING"] = "staging";
8
+ })(Environment || (exports.Environment = Environment = {}));
@@ -2,6 +2,7 @@ export * from "./app-route.enum";
2
2
  export * from "./ca.enum";
3
3
  export * from "./cloudfunction.enum";
4
4
  export * from "./evaluation.enum";
5
+ export * from "./environment.enum";
5
6
  export * from "./firestore.enum";
6
7
  export * from "./iap.enum";
7
8
  export * from "./like.enum";
@@ -18,6 +18,7 @@ __exportStar(require("./app-route.enum"), exports);
18
18
  __exportStar(require("./ca.enum"), exports);
19
19
  __exportStar(require("./cloudfunction.enum"), exports);
20
20
  __exportStar(require("./evaluation.enum"), exports);
21
+ __exportStar(require("./environment.enum"), exports);
21
22
  __exportStar(require("./firestore.enum"), exports);
22
23
  __exportStar(require("./iap.enum"), exports);
23
24
  __exportStar(require("./like.enum"), exports);
@@ -0,0 +1 @@
1
+ export declare function calculateAgeFromDateString(isoDateString: string): number;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.calculateAgeFromDateString = calculateAgeFromDateString;
4
+ function calculateAgeFromDateString(isoDateString) {
5
+ const birthDate = new Date(isoDateString);
6
+ const today = new Date();
7
+ const ageDiff = today.getFullYear() - birthDate.getFullYear();
8
+ const hasBirthdayPassed = today.getMonth() > birthDate.getMonth() ||
9
+ (today.getMonth() === birthDate.getMonth() &&
10
+ today.getDate() >= birthDate.getDate());
11
+ return hasBirthdayPassed ? ageDiff : ageDiff - 1;
12
+ }
@@ -1 +1,2 @@
1
1
  export * from "./time-label.util";
2
+ export * from "./age.util";
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./time-label.util"), exports);
18
+ __exportStar(require("./age.util"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "heartraite",
3
- "version": "1.0.82",
3
+ "version": "1.0.84",
4
4
  "description": "Heartraite npm package for common functionality",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,4 @@
1
+ export enum Environment {
2
+ PROD = "prod",
3
+ STAGING = "staging",
4
+ }
package/src/enum/index.ts CHANGED
@@ -2,6 +2,7 @@ export * from "./app-route.enum";
2
2
  export * from "./ca.enum";
3
3
  export * from "./cloudfunction.enum";
4
4
  export * from "./evaluation.enum";
5
+ export * from "./environment.enum";
5
6
  export * from "./firestore.enum";
6
7
  export * from "./iap.enum";
7
8
  export * from "./like.enum";
@@ -0,0 +1,12 @@
1
+ export function calculateAgeFromDateString(isoDateString: string): number {
2
+ const birthDate = new Date(isoDateString);
3
+ const today = new Date();
4
+
5
+ const ageDiff = today.getFullYear() - birthDate.getFullYear();
6
+ const hasBirthdayPassed =
7
+ today.getMonth() > birthDate.getMonth() ||
8
+ (today.getMonth() === birthDate.getMonth() &&
9
+ today.getDate() >= birthDate.getDate());
10
+
11
+ return hasBirthdayPassed ? ageDiff : ageDiff - 1;
12
+ }
@@ -1 +1,2 @@
1
1
  export * from "./time-label.util";
2
+ export * from "./age.util";