heartraite 1.0.83 → 1.0.85
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/types/request.types.d.ts +1 -0
- package/dist/utils/date/age.util.d.ts +1 -0
- package/dist/utils/date/age.util.js +12 -0
- package/dist/utils/date/index.d.ts +1 -0
- package/dist/utils/date/index.js +1 -0
- package/package.json +1 -1
- package/src/types/request.types.ts +1 -1
- package/src/utils/date/age.util.ts +12 -0
- package/src/utils/date/index.ts +1 -0
|
@@ -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
|
+
}
|
package/dist/utils/date/index.js
CHANGED
package/package.json
CHANGED
|
@@ -134,7 +134,7 @@ export type UpdateUserRequest = {
|
|
|
134
134
|
profile?: DeepPartial<UserProfile>;
|
|
135
135
|
preferences?: DeepPartial<DatingPreferences>;
|
|
136
136
|
notifications?: DeepPartial<
|
|
137
|
-
UserNotifications & { expoPushToken?: Partial<string
|
|
137
|
+
UserNotifications & { expoPushToken?: Partial<string>; platform?: string }
|
|
138
138
|
>;
|
|
139
139
|
geoLocation?: { lat: number; lng: number };
|
|
140
140
|
appVersion?: string;
|
|
@@ -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
|
+
}
|
package/src/utils/date/index.ts
CHANGED