0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Removed date handling validation in members importer logic

no issue

- This is handled on input sanitization layer with date
format check in JSON schema validation, so there's no need to do this
check again in the importer.
This commit is contained in:
Nazar Gargol 2020-08-25 18:49:53 +12:00
parent 544382b651
commit 9fe5007929

View file

@ -247,17 +247,6 @@ function getMemberData({members, allLabelModels, importSetLabels, createdBy}) {
let createdAt = member.created_at === '' ? undefined : member.created_at;
if (createdAt) {
const date = new Date(createdAt);
// CASE: client sends `0000-00-00 00:00:00`
if (isNaN(date)) {
// TODO: throw in validation stage for single record, not whole batch!
throw new errors.ValidationError({
message: i18n.t('errors.models.base.invalidDate', {key: 'created_at'}),
code: 'DATE_INVALID'
});
}
createdAt = moment(createdAt).toDate();
} else {
createdAt = new Date();