Files
musicland/src/actions/dateActions.js
T
Philip Cesar Garay 84fc719a10 update
2025-07-31 21:25:33 +08:00

19 lines
358 B
JavaScript

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);
}