mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
changed agenda edit event timepicker interval by 15 minutes
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user