function formatDate(date) {
  const year = date.getFullYear();
  const month = String(date.getMonth() + 1).padStart(2, '0');
  const day = String(date.getDate()).padStart(2, '0');
 
  return `${year}-${month}-${day}`;
}
 
function getBirthDateFromDays(daysOld) {
  const oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数
  const today = new Date(); // 获取当前日期
  const birthDate = new Date(today - (daysOld * oneDay)); // 减去指定的天数得到出生日期
 
  return formatDate(birthDate);
}
 
// 示例用法
const daysOld = 10000; // 指定出生天数
const birthDate = getBirthDateFromDays(daysOld);
console.log(`出生于 ${birthDate}`);