Timestamp Problem when Importing from Wordpress

I’m testing Ghost in a local environment (using the docker approach for migrating to Ghost 2.x). I’m importing content from an existing wordpress blog.

When I import the json dump from the (old) wordpress ghost plugin, all the posts have this warning about the date variable:

Post: Date is in a wrong format and invalid. It was replaced with the current timestamp.

In the JSON I see dates like "Mon, 22 Oct 2018 15:09:13 +0000". So I assumed that I needed timestamps and tried "1540220953" (which I tried as both a number and a string in the json). No luck. So I dumped out a date variable in node and got "2018-10-22T15:09:13.000Z".

I edited the json with all these alternatives but to no avail. So I checked the ghost importer source (for v1). I believe the relevant line is here: https://github.com/TryGhost/Ghost/blob/cd690efad15dc51546d9099c59a59af88b641f42/core/server/data/importer/importers/data/base.js#L74 and now I’m really confused because the last option there should have worked right?

What do my timestamps have to look like?

Sorry to bump this but am I correct in assuming that there’s just no support for importing from wordpress?

Okay, I figured out the problem here (shoutout to my roommate who actually may have figured it out and let me believe that I did).

Essentially, there are three date variables:

{
    "created_at": "2018-11-17 16:56:26",
    "updated_at": "2018-11-17 16:56:26",
    "published_at": ""
}

The wordpress exporter had the published_at variable set as an empty string for some posts (drafts maybe? but certainly the post that I ended up testing with [I was importing so many posts that I thought I was losing dates on all of them]).

So in short, each of these variables needs to be present (and in a format that new Date() can interpret), or this warning occurs. I haven’t tried other formats at this point but the one above was successful when I explicitly set published_at.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.