mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-21 13:55:51 +00:00
merge
This commit is contained in:
@@ -46,7 +46,7 @@ export class NewActionPage implements OnInit {
|
||||
public minDate = new Date().toISOString()
|
||||
public endMinDate = new Date(new Date().getTime() + 15 * 60000);
|
||||
public stepHour = 1;
|
||||
public stepMinute = 5;
|
||||
public stepMinute = 15;
|
||||
public stepSecond = 5;
|
||||
public dateControlStart = new FormControl(moment("DD MM YYYY hh"));
|
||||
public dateControlEnd = new FormControl(moment("DD MM YYYY hh"));
|
||||
@@ -98,9 +98,9 @@ export class NewActionPage implements OnInit {
|
||||
var validado: boolean;
|
||||
|
||||
if (window.innerWidth <= 800) {
|
||||
if ((this.folder.DateBegin < this.folder.DateEnd) && (new Date(this.folder.DateBegin).getTime() > this.currentDate.getTime())) {
|
||||
if ((this.folder.DateBegin < this.folder.DateEnd)) {
|
||||
validado = true;
|
||||
}else{
|
||||
} else {
|
||||
validado = false;
|
||||
}
|
||||
return validado == true ? ['ok']: [];
|
||||
@@ -111,8 +111,8 @@ export class NewActionPage implements OnInit {
|
||||
|
||||
runValidation() {
|
||||
this.validateFrom = true;
|
||||
if(new Date(this.folder.DateBegin).toISOString() > new Date(this.folder.DateEnd).toISOString()){
|
||||
this.toastService.badRequest("A data de início não pode ser superior a data de fim");
|
||||
if(new Date(this.folder.DateBegin).getTime() > new Date(this.folder.DateEnd).getTime()){
|
||||
this.toastService._badRequest("A data de início não pode ser superior a data de fim");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,4 +171,42 @@ export class NewActionPage implements OnInit {
|
||||
this.modalController.dismiss();
|
||||
}
|
||||
|
||||
|
||||
roundTimeQuarterHour() {
|
||||
var timeToReturn = new Date();
|
||||
var minutes = timeToReturn.getMinutes();
|
||||
var hours = timeToReturn.getHours();
|
||||
|
||||
var m = (Math.round(minutes/15) * 15) % 60;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
return timeToReturn;
|
||||
}
|
||||
|
||||
setStartDate(){
|
||||
this.dateControlStart = new FormControl(moment(this.roundTimeQuarterHour()));
|
||||
}
|
||||
|
||||
setEndDate(){
|
||||
this.dateControlEnd = this.dateControlStart;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user