Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

fix

Marc Seitz39ec3f033837
diff --git a/lib/year-in-review/get-stats.ts b/lib/year-in-review/get-stats.ts
index 699ca4e4..033ad18a 100644
--- a/lib/year-in-review/get-stats.ts
+++ b/lib/year-in-review/get-stats.ts
@@ -449,12 +449,14 @@ export async function getYearInReviewStats(
const countryCodes = Array.from(allCountries);
// Determine origin point from user's IP location or use default
+ const parsedLat =
+ userGeo?.latitude !== undefined ? Number(userGeo.latitude) : NaN;
+ const parsedLng =
+ userGeo?.longitude !== undefined ? Number(userGeo.longitude) : NaN;
+
const origin =
- userGeo?.latitude && userGeo?.longitude
- ? {
- lat: parseFloat(userGeo.latitude),
- lng: parseFloat(userGeo.longitude),
- }
+ Number.isFinite(parsedLat) && Number.isFinite(parsedLng)
+ ? { lat: parsedLat, lng: parsedLng }
: DEFAULT_ORIGIN;
// Calculate total distance traveled based on IP locations