From da5586e5aa75455462e2b098fd13a898297c49f6 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 --- core/server/services/members/importer/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/server/services/members/importer/index.js b/core/server/services/members/importer/index.js index 59071d1cdb..2e5ad8aa1f 100644 --- a/core/server/services/members/importer/index.js +++ b/core/server/services/members/importer/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 = {