Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSCEXAM-1204 Fix min date mechanism for date-time-picker #1140

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ <h1 class="xm-modal-title">
[minuteStep]="15"
[readonly]="true"
[initialTime]="start()"
[minDate]="examMinDate"
[maxDate]="examMaxDate"
(updated)="onStartDateChange($event)"
autofocus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export class ExaminationEventDialogComponent implements OnInit {
@Input() config?: ExaminationEventConfiguration;
@Input() maintenancePeriods: MaintenancePeriod[] = [];
@Input() requiresPassword = false;
@Input() examMinDate = '';
@Input() examMaxDate = '';
start = signal(new Date(new Date().getTime() + 60 * 1000));
description = signal('');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ export class ExamPublicationComponent implements OnInit {
size: 'lg',
});
modalRef.componentInstance.requiresPassword = this.exam.implementation === 'CLIENT_AUTH';
modalRef.componentInstance.examMinDate = this.exam.periodStart;
modalRef.componentInstance.examMaxDate = this.exam.periodEnd;
modalRef.componentInstance.maintenancePeriods = this.maintenancePeriods;
modalRef.componentInstance.examId = this.exam.id;
Expand Down
3 changes: 1 addition & 2 deletions ui/src/app/shared/date/date-time-picker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ export class DateTimePickerComponent implements OnInit, OnChanges {
@Input() minuteStep = 0;
@Input() disabled = false;
@Input() readonly = false;
@Input() minDate = new Date().toISOString();
@Input() maxDate?: string;
@Input() disableDate?: boolean = false;
@Input() disableTime?: boolean = false;
@Output() updated = new EventEmitter<{ date: Date }>();

date: Date = new Date();
time!: { hour: number; minute: number; second: number; millisecond?: number };
minDate?: string;

ngOnInit() {
const now = new Date();
Expand All @@ -70,7 +70,6 @@ export class DateTimePickerComponent implements OnInit, OnChanges {
if (this.initialTime) {
this.setDateTime(this.initialTime);
}
this.minDate = now.toISOString();
}

ngOnChanges() {
Expand Down