// date is the moment you're calculating the age of
var now = moment().unix();
var then = date.unix();
var diff = (now - then) / (60 * 60 * 24 * 365);
var years = Math.floor(diff);
var m = moment(d.birthday.date, "DD.MM.YYYY");
var years = moment().diff(m, 'years', false);
var days = moment().diff(m.add(years, 'years'), 'days', false);
alert(years + ' years, ' + days + ' days');
let dt = dob;
let age = '';
let bY = Number(moment(dt).format('YYYY'));
let bM = Number(moment(dt).format('MM'));
let bD = Number(moment(dt).format('DD'));
let tY = Number(moment().format('YYYY'));
let tM = Number(moment().format('MM'));
let tD = Number(moment().format('DD'));
age += (tY - bY) + ' Y ';
if (tM < bM) {
age += (tM - bM + 12) + ' M ';
tY = tY - 1;
} else {
age += (tM - bM) + ' M '
}
if (tD < bD) {
age += (tD - bD + 30) + ' D ';
tM = tM - 1;
} else {
age += (tD - bD) + ' D '
}
//AGE MONTH DAYS
console.log(age);