'use strict';

var dayjs = require('dayjs');

function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }

var dayjs__default = /*#__PURE__*/_interopDefault(dayjs);

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

exports.ageGenerate = ageGenerate;
