performance improvments

This commit is contained in:
dimitar committed 2026-03-18 02:04:09 +01:00
1 parent 912981e3f3
commit 02c9681aca
13 files changed
+805 -474

No files matched your search

+11 -7
View File
@@ -9,9 +9,10 @@ import { formatDate } from "@/lib/utils";
ModuleRegistry.registerModules([AllCommunityModule]);
function getTimeAgo(date: Date): string {
function getTimeAgo(date: Date | string): string {
const now = new Date();
const diffMs = now.getTime() - date.getTime();
const d = typeof date === "string" ? new Date(date) : date;
const diffMs = now.getTime() - d.getTime();
const diffMins = Math.floor(diffMs / 60000);
const diffHours = Math.floor(diffMins / 60);
const diffDays = Math.floor(diffHours / 24);
@@ -22,7 +23,7 @@ function getTimeAgo(date: Date): string {
return `${diffDays}d ago`;
}
interface User {
export interface User {
id: string;
email: string;
firstName: string;
@@ -31,15 +32,18 @@ interface User {
phone?: string;
gymId?: string;
gymName?: string | null;
createdAt: Date;
createdAt?: string | Date;
isCheckedIn?: boolean;
checkInTime?: Date;
checkInTime?: string | Date;
lastCheckInTime?: string | Date;
checkInsThisWeek?: number;
checkInsThisMonth?: number;
client?: {
id: string;
membershipType: string;
membershipStatus: string;
joinDate: Date;
lastVisit?: Date;
joinDate: string | Date;
lastVisit?: string | Date;
};
}