Days since you were born

Calculate the number of days you have been alive.

Face with waiting expression Nothing to see yet!

Loading takeymakey...
TakeyMakey code
Want this tool to do something else? Edit the code below and make it do whatever you want.
({
  take: [
    { key: "y", type: "number", label: "Year", value: 1988 },
    { key: "m", type: "number", label: "Month", value: 1, min: 1, max: 12 },
    { key: "d", type: "number", label: "Day", value: 23, min: 1, max: 31 },
  ],
  make: ({ y, m, d }) => {
    const d0 = new Date()
    const d1 = new Date().setFullYear(y, m - 1, d)

    const dayMs = 1000 * 60 * 60 * 24
    const delta = Math.abs(Math.round((d1 - d0) / dayMs))

    const lang = "default"
    const days = new Intl.NumberFormat(lang).format(delta)
    const date = new Intl.DateTimeFormat(lang, {
      year: "numeric",
      day: "numeric",
      month: "long",
      weekday: "long",
      era: y < 1200 ? "short" : undefined,
    }).format(d1)

    const isOrAre = delta === 1 ? "is" : "are"
    const dayOrDays = delta === 1 ? "day" : "days"

    return d1 - d0 === 0
      ? `It's ${date} today!`
      : d1 - d0 > 0
      ? `There ${isOrAre} ${days} ${dayOrDays} to go until ${date}!`
      : `It's been ${days} ${dayOrDays} since ${date}!`
  },
})