diff --git a/assets/js/src/subscribers/importExport/import.js b/assets/js/src/subscribers/importExport/import.js
index 3f2cee6c8c..6bc5c4d816 100644
--- a/assets/js/src/subscribers/importExport/import.js
+++ b/assets/js/src/subscribers/importExport/import.js
@@ -768,6 +768,7 @@ define(
'id': response.field.id,
'name': response.field.name,
'type': response.field.type,
+ 'params': response.field.params,
'custom': true
};
// if this is the first custom column, create an "optgroup"
@@ -880,6 +881,7 @@ define(
if (column.type === 'date' && matchedColumn !== -1) {
jQuery.map(subscribersClone.subscribers, function (data, position) {
var rowData = data[matchedColumn];
+ var dateFormat = column.params.date_format.toUpperCase();
if (position !== fillterPosition) {
// check if date exists
if (rowData.trim() === '') {
@@ -892,17 +894,21 @@ define(
return;
}
// check if date is valid and is before today
- if (Moment(rowData).isValid() && Moment(rowData).isBefore(Moment())) {
+ if (Moment(rowData, dateFormat, true).isValid() &&
+ Moment(rowData, dateFormat, true).isBefore(Moment())
+ ) {
data[matchedColumn] +=
''
- + MailPoet.Date.format(rowData) + '';
+ + MailPoet.Date.format(Moment(rowData, dateFormat, true))
+ + '';
}
else {
data[matchedColumn] +=
''
- + MailPoet.I18n.t('dateMatchError') + '';
+ + MailPoet.I18n.t('dateMatchError') + ' (' + dateFormat + ') '
+ + '';
preventNextStep = true;
}
}
diff --git a/lib/Subscribers/ImportExport/ImportExportFactory.php b/lib/Subscribers/ImportExport/ImportExportFactory.php
index 7de44c3b56..f2e0db154c 100644
--- a/lib/Subscribers/ImportExport/ImportExportFactory.php
+++ b/lib/Subscribers/ImportExport/ImportExportFactory.php
@@ -58,6 +58,7 @@ class ImportExportFactory {
'id' => $field['id'],
'name' => $field['name'],
'type' => $field['type'],
+ 'params' => unserialize($field['params']),
'custom' => true
);
}, $subscriber_custom_fields);