import dayjs from 'dayjs';

const ageGenerate = (birthDate, calculateDate = new Date()) => {
    const numberOfWeek = Math.ceil(dayjs(calculateDate).diff(birthDate, 'week', true));
    const numberOfMonth = dayjs(calculateDate).diff(birthDate, 'month');
    const numberOfYear = Math.floor(numberOfMonth / 12);
    return {
        year: numberOfYear,
        month: numberOfMonth % 12,
        week: numberOfWeek,
    };
};

export { ageGenerate as a };
