diff --git a/source/plugins/core/index.mjs b/source/plugins/core/index.mjs index a198f2ba..bc825030 100644 --- a/source/plugins/core/index.mjs +++ b/source/plugins/core/index.mjs @@ -93,7 +93,9 @@ export default async function({login, q}, {conf, data, rest, graphql, plugins, q const created = new Date(data.user.createdAt) const diff = now - created const years = new Date(diff).getUTCFullYear() - new Date(0).getUTCFullYear() - const months = new Date(now).getUTCMonth() - created.getUTCMonth() + 12 * years + const nowMonth = new Date(now).getUTCMonth() + const createdMonth = created.getUTCMonth() + const months = nowMonth - createdMonth + 12 * (years + (nowMonth < createdMonth ? 1 : 0)) const days = Math.floor((now - beginningOfYear) / (1000 * 60 * 60 * 24)) computed.registered = {years: years + days / 365.25, months} computed.registration = years ? `${years} year${imports.s(years)} ago` : months ? `${months} month${imports.s(months)} ago` : `${days} day${imports.s(days)} ago`