diff --git a/scripts/cleaning/utils.js b/scripts/cleaning/utils.js index 0224f01aed..310491798e 100644 --- a/scripts/cleaning/utils.js +++ b/scripts/cleaning/utils.js @@ -19,13 +19,9 @@ function getClient(accessToken, env, organizationId) { } function wasCreatedBefore(amount, unit) { - return (resource) => { + return (key) => { const limit = moment().subtract(amount, unit); - for (const createField of ['createdDate', 'created']) { - if (resource[createField]) { - return moment(resource[createField]).isBefore(limit); - } - } + return moment(key.createdDate).isBefore(limit); }; }