Skip to content

Conversation

@maximepvrt
Copy link
Contributor

@maximepvrt maximepvrt commented Jan 24, 2026

This PR addresses two separate improvements:

  1. Fix SQL syntax error introduced by https://github.com/nuxt/content/pull/3673/changes
 ERROR  [unhandledRejection] near "20": syntax error                  14:55:45

    at Database.exec (node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/lib/methods/wrappers.js:9:14)
    at Object.exec (node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected]__better-sql_71033862cb6d26be682bfee7871b05d1/node_modules/db0/dist/connectors/better-sqlite3.mjs:24:26)
    at Object.exec (src/utils/database.ts:156:10)
    at processCollectionItems (src/module.ts:423:10)
    at async src/module.ts:252:20
    at async initNuxt (node_modules/.pnpm/[email protected]_91645c95ed588071e154b0779b0d0c3a/node_modules/nuxt/dist/index.mjs:5390:3)
    at async #initializeNuxt (node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@nuxt/cli/dist/dev-KB30iboK.mjs:492:3)
    at async NuxtDevServer.init (node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@nuxt/cli/dist/dev-KB30iboK.mjs:384:3)
    at async initialize (node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@nuxt/cli/dist/dev-KB30iboK.mjs:685:2)
    at async Object.run (node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@nuxt/cli/dist/dev-CsAvgRwH.mjs:205:51)
  1. Standardize date/datetime formats

    • Dates are now stored as YYYY-MM-DD
    • Datetimes are now stored as YYYY-MM-DD HH:mm:ss

These are the default storage formats for dates in databases, ensuring consistent behavior across queries.

I chose to use @internationalized/date, as in Nuxt UI / Reka, because the native Date object implicitly applies the server timezone when none is specified, which can shift datetime values.

new Date('2026-01-28 20:00:00').toISOString()
// → 2026-01-28T19:00:00.000Z (in my computer with Europe/Paris timezone)

It’s therefore better to let the nuxt application decide whether a date is GMT or timezone-aware, which is why CalendarDateTime is more appropriate.

@vercel
Copy link

vercel bot commented Jan 24, 2026

@maximepvrt is attempting to deploy a commit to the Nuxt Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link

coderabbitai bot commented Jan 24, 2026

📝 Walkthrough

Walkthrough

Added two new schema fields to the people collection: birthday (date) and lastloginat (datetime). Introduced two formatting helpers (formatDate and formatDateTime) and updated runtime and utility code to use explicit date vs datetime branches for formatting and SQL generation. Added the @internationalized/date dependency. Updated unit tests to include and assert the new date/datetime fields and their serialized SQL output.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the two main changes: fixing a syntax error with datetime fields and standardizing date/datetime formats.
Description check ✅ Passed The description clearly explains both the SQL syntax error fix and the date/datetime standardization, including technical context and justification for the approach.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 28, 2026

npm i https://pkg.pr.new/@nuxt/content@3698

commit: fc34e2e

@maximepvrt maximepvrt marked this pull request as ready for review January 28, 2026 22:36
@maximepvrt
Copy link
Contributor Author

maximepvrt commented Jan 28, 2026

@Joehoel This PR should resolve the issue, I would appreciate if you can verify using npm i https://pkg.pr.new/@nuxt/content@3698

Joehoel added a commit to Joehoel/site that referenced this pull request Jan 28, 2026
Testing fix for datetime fields syntax error.
Uses pkg.pr.new build: https://pkg.pr.new/@nuxt/content@3698

Ref: nuxt/content#3698 (comment)
@maximepvrt
Copy link
Contributor Author

@farnabaz If you prefer using an ISO datetime format like YYYY-MM-DDTHH:mm:ss (with the T separating date and time), you’ll need to transform the values returned by Postgres for datetime fields. Otherwise, Nuxt Studio will generate a conflict if the format doesn’t match the entered value (Postgres removes the T and replaces it with a space).

I can also look into removing the dependency on @internationalized/date if you want, I found a solution using the native Date API, it’s just a bit more verbose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant