changed agenda edit event timepicker interval by 15 minutes

This commit is contained in:
Hirondino Van-Dunem
2022-12-17 17:01:36 +01:00
parent c357966d2e
commit e5a5d94f67
4 changed files with 74 additions and 8 deletions
@@ -163,7 +163,7 @@
<input matInput [ngxMatDatetimePicker]="fim"
placeholder="Choose a date"
[(ngModel)]="postEvent.EndDate"
[min]="currentDate"
[min]="postEvent.StartDate"
[max]="maxDate"
[disabled]="disabled"
>
@@ -66,9 +66,9 @@ export class EditEventPage implements OnInit {
public endMinDate = new Date(new Date().getTime() + 15 * 60000).toISOString().slice(0,10)
public maxDate: any;
public stepHour = 1;
public stepMinute = 5;
public stepSecond = 5;
currentDate = new Date();
public stepMinute = 15;
public stepSecond = 15;
currentDate = this.roundTimeQuarterHour();
loadedEventAttachments: Attachment[] = [];
taskParticipants: any = [];
@@ -171,6 +171,39 @@ export class EditEventPage implements OnInit {
});
}
roundTimeQuarterHour() {
var timeToReturn = new Date();
// var minutes = timeToReturn.getMinutes();
var minutes = timeToReturn.getMinutes();
var hours = timeToReturn.getHours();
// console.log("MINUTOS: " +minutes);
// console.log("BEFORE MINUTES: " +(Math.round(minutes/15) * 15));
var m = (Math.round(minutes/15) * 15) % 60;
// console.log("AFTER MINUTES: " +m);
var h = minutes > 52 ? (hours === 23 ? 0 : ++hours) : hours;
if (m == 0) {
if(minutes > m){
m = m + 15;
}
timeToReturn.setHours(h);
timeToReturn.setMinutes(m);
}else{
if(minutes > m){
m = m + 15;
timeToReturn.setHours(h);
timeToReturn.setMinutes(m);
}else {
timeToReturn.setHours(h);
timeToReturn.setMinutes(m);
}
}
}
onSelectedRecurringChanged(ev?:any) {
this.calculetedLastOccurrence(ev);
@@ -147,7 +147,7 @@
[(ngModel)]="postEvent.EndDate"
[max]="maxDate"
[disabled]="disabled"
[min]="currentDate"
[min]="postEvent.StartDate"
>
<mat-datepicker-toggle id="new-fim" matSuffix [for]="fim"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #fim
@@ -46,9 +46,9 @@ export class EditEventPage implements OnInit {
public endMinDate = new Date(new Date().getTime() + 15 * 60000).toISOString().slice(0,10)
public maxDate: any;
public stepHour = 1;
public stepMinute = 5;
public stepSecond = 5;
currentDate = new Date();
public stepMinute = 15;
public stepSecond = 15;
currentDate = this.roundTimeQuarterHour();
Form: FormGroup;
validateFrom = false
@@ -216,6 +216,39 @@ export class EditEventPage implements OnInit {
}
}
roundTimeQuarterHour() {
var timeToReturn = new Date();
// var minutes = timeToReturn.getMinutes();
var minutes = timeToReturn.getMinutes();
var hours = timeToReturn.getHours();
// console.log("MINUTOS: " +minutes);
// console.log("BEFORE MINUTES: " +(Math.round(minutes/15) * 15));
var m = (Math.round(minutes/15) * 15) % 60;
// console.log("AFTER MINUTES: " +m);
var h = minutes > 52 ? (hours === 23 ? 0 : ++hours) : hours;
if (m == 0) {
if(minutes > m){
m = m + 15;
}
timeToReturn.setHours(h);
timeToReturn.setMinutes(m);
}else{
if(minutes > m){
m = m + 15;
timeToReturn.setHours(h);
timeToReturn.setMinutes(m);
}else {
timeToReturn.setHours(h);
timeToReturn.setMinutes(m);
}
}
}
onSelectedRecurringChanged(ev:any){
this.calculetedLastOccurrence(ev);