fix(models): birthdate on user has maybe null

This commit is contained in:
Slincnik 2025-01-16 18:23:03 +03:00
parent 4272ae63b0
commit 33363f64fc
No known key found for this signature in database
2 changed files with 2 additions and 2 deletions

View file

@ -35,7 +35,7 @@ export const data = {
const user = users.find(u => u.id === userID);
if (!user) return;
const userData = new Date(user.birthdate).getFullYear() <= 1970 ? new Date(user.birthdate * 1000) : new Date(user.birthdate);
const userData = new Date(user.birthdate!).getFullYear() <= 1970 ? new Date(user.birthdate! * 1000) : new Date(user.birthdate!);
const userYear = userData.getFullYear();
const userMonth = userData.getMonth();
const userDate = userData.getDate();

View file

@ -11,7 +11,7 @@ interface IUserSchema extends Document {
id: string;
rep: number;
bio: string;
birthdate: number;
birthdate: number | null;
lover: string;
registeredAt: number;
achievements: {