This commit is contained in:
tiago.kayaya
2021-11-03 15:35:01 +01:00
parent adc80aaff3
commit 3f6b053660
11 changed files with 120 additions and 76 deletions
+34 -1
View File
@@ -49,7 +49,7 @@ export class TimeService {
let c_minutes = Math.floor((difference % (1000*60*60)) / (1000*60));
let c_seconds = Math.floor((difference % (1000*60)) / 1000);
this.countDownTime = c_day + " : " + c_hours + " : " + c_minutes + " : " + c_seconds ;
this.countDownTime = this.addZero(c_day) + " : " + this.addZero(c_hours) + " : " + this.addZero(c_minutes) + " : " + this.addZero(c_seconds) ;
if(difference < 0){
//clearInterval(timer);
@@ -74,6 +74,39 @@ export class TimeService {
return this.countDownTime;
}
countDownDateTimer(date:any, roomId:string){
let timer = setInterval(() =>{
let difference = new Date(date).getTime() - new Date().getTime();
let c_day = Math.floor(difference/(1000*60*60*24));
let c_hours = Math.floor((difference % (1000*60*60*24)) / (1000*60*60));
let c_minutes = Math.floor((difference % (1000*60*60)) / (1000*60));
let c_seconds = Math.floor((difference % (1000*60)) / 1000);
this.countDownTime = this.addZero(c_day) + " : " + this.addZero(c_hours) + " : " + this.addZero(c_minutes) + " : " + this.addZero(c_seconds) ;
if(difference < 0){
clearInterval(timer);
this.countDownTime = "Expired";
let body = { "roomId":roomId, }
this.chatService.getRoomInfo(roomId).subscribe(room=>{
this.room = room['room'];
if(this.room.t === 'p'){
this.chatService.deleteGroup(body).subscribe(res=>{
console.log(res);
});
}
else{
this.chatService.deleteChannel(body).subscribe(res=>{
console.log(res);
});
}
});
}
})
return this.countDownTime;
}
addZero(i) {
if (i < 10) {
i = "0" + i;