0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

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
This commit is contained in:
Scott Cabot 2020-11-20 11:39:02 +10:30 committed by Daniel Lockyer
parent 1e5d201835
commit da5586e5aa

View file

@ -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 = {