This commit is contained in:
Philip Cesar Garay
2025-07-31 21:25:33 +08:00
parent 5cfbc81e3a
commit 84fc719a10
307 changed files with 46470 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
import moment from 'moment';
export const validateDate = (date = null) => {
if (!date) {
return null;
}
if (moment(date).isValid()) {
return date;
}
if (typeof date?.toDate === 'function') {
return date?.toDate();
}
return null;
};
export function getAge(birthDate) {
return moment().diff(birthDate.toDate(), 'years', false);
}