From 1d65c9367c6144471f3cb5fe5b4d50e2f5bb538a Mon Sep 17 00:00:00 2001 From: Scott Cabot Date: Fri, 20 Nov 2020 11:39:02 +1030 Subject: [PATCH] Fixed user import with no created_at date breaking graph - users imported from CSV with no created_at date where having their created_at date being stored as an int rather than a datetime. - this was causing parsing issues with the graph so this commit fixes the formatting --- ghost/members-importer/lib/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ghost/members-importer/lib/index.js b/ghost/members-importer/lib/index.js index 59071d1cdb..2e5ad8aa1f 100644 --- a/ghost/members-importer/lib/index.js +++ b/ghost/members-importer/lib/index.js @@ -248,10 +248,13 @@ function getMemberData({members, labels, importSetLabels, createdBy}) { let createdAt = member.created_at === '' ? undefined : member.created_at; + // fixes a formatting issue where inserted dates are showing up as ints and not date times... + const dateFormat = 'YYYY-MM-DD HH:mm:ss'; + if (createdAt) { - createdAt = moment(createdAt).toDate(); + createdAt = moment(createdAt).format(dateFormat); } else { - createdAt = new Date(); + createdAt = moment().format(dateFormat); } const memberToInsert = {