docs: fix birthday comparison (#1029)

This commit is contained in:
Konstantin
2024-12-27 09:19:22 +03:00
committed by GitHub
parent 717134fe75
commit 2c81db93be

View File

@@ -134,7 +134,7 @@ import { createAuthMiddleware } from "better-auth/plugins";
const today = new Date();
const fiveYearsAgo = new Date(today.setFullYear(today.getFullYear() - 5));
if(birthday <= fiveYearsAgo) {
if(birthday >= fiveYearsAgo) {
throw new APIError("BAD_REQUEST", { message: "User must be above 5 years old." });
}
@@ -230,4 +230,4 @@ We highly recommend you visit our <Link href="/docs/concepts/plugins">plugins do
If you have a plugin youd like to share with the community, feel free to let us know through
our <Link href="https://discord.gg/6jHcdYMzyq">Discord server</Link>,
or through a <Link href="https://github.com/better-auth/better-auth/pulls">pull-request</Link>
and we may add it to the <Link href="/docs/plugins/community-plugins">community-plugins</Link> list!
and we may add it to the <Link href="/docs/plugins/community-plugins">community-plugins</Link> list!