Skip to content

Unquoted YAML frontmatter date silently becomes '' (sorts last, renders Invalid Date) #20

Description

@CharanMN7

Bug

`loadBlogPosts`/`loadBlogPost`/`loadChangelogEntries` in `packages/framework/src/content.ts` parse frontmatter with:

date: typeof data.date === 'string' ? data.date.slice(0, 10) : '',

An unquoted YAML date, e.g.

date: 2026-01-25

is parsed by `gray-matter` (via `js-yaml`) as a native JS `Date` object, not a string — YAML's own spec treats YYYY-MM-DD as the built-in !!timestamp type. Because the check is a bare typeof === 'string', the Date instance fails it and the loader silently writes date: '' for that post.

Downstream effects:

  • The post sorts last ('' is the smallest string) regardless of actual publish date.
  • Anything rendering the date (post header, sitemap lastmod, RSS) shows Invalid Date or an empty value.
  • status: scheduled posts never go live, since isLive() compares date <= today and '' <= today is false... actually '' <= anything is true lexicographically for this comparison in JS, so behavior is inconsistent/surprising either way — the real point is the date is silently wrong, not documented, and easy to ship without noticing (build succeeds, no warning).

Found while auditing three live sites — confirmed content/blog/*.mdx in ai-charan-dev (and likely hardware-charan-dev, mlnotes-dev) all use unquoted dates today, so their blogs are shipping with this bug live.

Why it's easy to hit

Nothing in the blog guide (framework.inkform.dev/guides/blog) or the example frontmatter tells authors to quote the date. The example in the guide itself (date: 2026-09-05) is unquoted.

Fix

Coerce a Date instance to YYYY-MM-DD instead of dropping it, in both toBlogPost() and loadChangelogEntries(). PR incoming.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions