Skip to content

Commit

Permalink
Merge branch 'development' into DES/enhancement/#705-vl-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
brenner-company committed Mar 19, 2021
2 parents 53a8b60 + 56e001f commit 5ac1d2d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions app/pods/publications/publication/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,13 @@ export default class PublicationController extends Controller {
return true;
}
}
const end = moment(this.model.publicationFlow.get('publishBefore'));
// If there is no publishBefore, allow all future dates
const publishBefore = this.model.publicationFlow.get('publishBefore');
if (!publishBefore && moment(date).isSameOrAfter(moment())) {
return true;
}
// If there is a publishbefore, only allow dates between now and that date
const end = moment(publishBefore);
if (moment(date).isSameOrBefore(end) && moment(date).isSameOrAfter(moment())) {
return true;
}
Expand Down Expand Up @@ -312,7 +318,7 @@ export default class PublicationController extends Controller {
set(this, 'showTranslationDatePicker', false);
const date = moment(new Date(event));
const translateBefore = this.model.publicationFlow.get('translateBefore');
if (typeof translateBefore !== undefined && !moment(translateBefore).isSameOrBefore(date, 'minutes')) {
if (translateBefore !== undefined && !moment(translateBefore).isSameOrBefore(date, 'minutes')) {
this.publicationNotAfterTranslationForPublication = true;
this.toaster.error(this.intl.t('publication-date-after-translation-date'), this.intl.t('warning-title'), {
timeOut: 5000,
Expand Down Expand Up @@ -351,7 +357,7 @@ export default class PublicationController extends Controller {
set(this, 'showTranslationDatePicker', false);
const date = moment(new Date(event));
const publishBefore = this.model.publicationFlow.get('publishBefore');
if (typeof publishBefore !== undefined && !moment(date).isSameOrBefore(publishBefore)) {
if (publishBefore !== undefined && !moment(date).isSameOrBefore(publishBefore)) {
this.publicationNotAfterTranslationForTranslation = true;
this.toaster.error(this.intl.t('publication-date-after-translation-date'), this.intl.t('warning-title'), {
timeOut: 5000,
Expand Down

0 comments on commit 5ac1d2d

Please sign in to comment.