app/assets/javascripts/admin/validations/scheduled_status_validation.js in trusty-cms-7.0.5 vs app/assets/javascripts/admin/validations/scheduled_status_validation.js in trusty-cms-7.0.6
- old
+ new
@@ -34,26 +34,29 @@
hideError();
return true;
}
- function validateDateTime() {
+ function validateDateTime(status) {
const publishedAt = $('#page_published_at').val();
- const status = $('#page_status_id').val();
const publishedTime = new Date(publishedAt);
const currentTime = new Date();
if (status === '90') {
return validateScheduledStatus(publishedTime, currentTime);
}
if (status === '100') {
return validatePublishedStatus(publishedTime, currentTime);
}
+
+ return true;
}
$('#save-button, #save-and-continue-button').on('click', function(event) {
- if (!validateDateTime()) {
+ const status = $('#page_status_id').val();
+
+ if (status && !validateDateTime(status)) {
event.preventDefault();
event.stopImmediatePropagation();
}
});
});