From 53b6ad16d88b2c1c4d9553fdbd5c95486aa63978 Mon Sep 17 00:00:00 2001 From: Nazar Gargol Date: Mon, 9 Mar 2020 20:12:02 +0800 Subject: [PATCH] Fixed handling of empty created_at dates in member CSV imorts no issue - When created_at value is not provided it should be treated as an empty one instead of trying to import empty string. - This scenario happens when the column is defined in CSV but no values are present (default parsed value is empty string '') --- core/server/api/canary/members.js | 2 +- core/test/utils/fixtures/csv/valid-members-import.csv | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/server/api/canary/members.js b/core/server/api/canary/members.js index ad302e5813..ecfaf30cd2 100644 --- a/core/server/api/canary/members.js +++ b/core/server/api/canary/members.js @@ -364,7 +364,7 @@ const members = { stripe_customer_id: entry.stripe_customer_id, comped: (String(entry.complimentary_plan).toLocaleLowerCase() === 'true'), labels: entryLabels, - created_at: entry.created_at + created_at: entry.created_at === '' ? undefined : entry.created_at }] }, options: { diff --git a/core/test/utils/fixtures/csv/valid-members-import.csv b/core/test/utils/fixtures/csv/valid-members-import.csv index 613022354d..48f37ad915 100644 --- a/core/test/utils/fixtures/csv/valid-members-import.csv +++ b/core/test/utils/fixtures/csv/valid-members-import.csv @@ -1,3 +1,3 @@ -email,name,subscribed_to_emails -jbloggs@example.com,joe,true -test@example.com,test,false +email,name,subscribed_to_emails,created_at +jbloggs@example.com,joe,true, +test@example.com,test,false,"1991-10-02T20:30:31.000Z"