Date condition on where function

Hello everyone, so I have this schema of accounts and I want to get all the data from the current date

export const accounts = mysqlTable("account", {
  ...
  date: date("date").notNull(),
  userId: varchar("userId", { length: 191 }).notNull(),
});


I'm using this query like this and I'm not getting anything back

const userAcounts = await db
    .select({
      amount: sql<number>`sum(${accounts.amount})`,
      date: accounts.date,
      type: accounts.type,
    })
    .from(accounts)
    .where(and(eq(accounts.userId, user?.id!), eq(accounts.date, new Date())))
    .groupBy(accounts.date, accounts.type)
    .orderBy(desc(accounts.date));
Was this page helpful?