Finished guestbook and gallery. started diary
This commit is contained in:
@@ -51,6 +51,18 @@ class BaseService {
|
||||
const ageDate = new Date(ageDifMs);
|
||||
return Math.abs(ageDate.getUTCFullYear() - 1970);
|
||||
}
|
||||
|
||||
|
||||
async isUserAdult(userId) {
|
||||
const birthdateParam = await this.getUserParams(userId, ['birthdate']);
|
||||
if (!birthdateParam || birthdateParam.length === 0) {
|
||||
return false;
|
||||
}
|
||||
const birthdate = birthdateParam[0].value;
|
||||
const age = this.calculateAge(birthdate);
|
||||
return age >= 18;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default BaseService;
|
||||
|
||||
Reference in New Issue
Block a user