Skip to content

Error with post.pubDate?. is not a function #552

Open
@Terieyenike

Description

@Terieyenike

In the getting started guide with Next.js, I discovered this error under the query and list posts section and fixed it with a function as shown below. It was possible as I passed the data in the function.

function getCurrentDate(date) {
    return new Date(date)
  }

JSX

<p className="text-xs mb-2 text-purple-950 dark:text-purple-200">{getCurrentDate(post.pubDate)?.toDateString()}</p>

https://xata.io/docs/getting-started/nextjs

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