Add validation for mobile

This commit is contained in:
Peter Maquiran
2021-07-05 15:28:54 +01:00
parent b0ab5a7eb9
commit ba2af92a6d
12 changed files with 62 additions and 34 deletions
@@ -14,7 +14,6 @@ import { AttendeesPageModal } from '../../events/attendees/attendees.page';
import { SearchPage } from '../../search/search.page';
import { ThemePalette } from '@angular/material/core';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import * as moment from 'moment';
@Component({
@@ -31,7 +30,7 @@ export class NewEventPage implements OnInit {
public showSeconds = false;
public touchUi = false;
public enableMeridian = false;
public minDate = new Date();
public minDate = new Date().toISOString().slice(0,10)
public endMinDate = new Date(new Date().getTime() + 15 * 60000);
public stepHour = 1;
public stepMinute = 5;
@@ -146,6 +145,15 @@ export class NewEventPage implements OnInit {
this.validateFrom = true
}
get dateValid() {
if (window.innerWidth <= 800) {
return this.postEvent.StartDate < this.postEvent.EndDate? ['ok']: []
} else {
return ['ok']
}
}
injectValidation() {
this.Form = new FormGroup({
@@ -159,6 +167,9 @@ export class NewEventPage implements OnInit {
CalendarName: new FormControl(this.postEvent.CalendarName, [
Validators.required
]),
Date: new FormControl(this.dateValid, [
Validators.required
]),
Categories: new FormControl(this.postEvent.Categories[0], [
Validators.required
]),