This commit is contained in:
Peter Maquiran
2022-12-19 17:04:21 +01:00
parent 7543f319b8
commit 2b85796a5f
15 changed files with 325 additions and 416 deletions
+28 -28
View File
@@ -17,7 +17,7 @@ export class TimeService {
end = new Date();
start = new Date(start);
const totalSeconds = Math.floor((end - (start))/1000);;
const totalSeconds = Math.floor((end - (start))/1000);
const totalMinutes = Math.floor(totalSeconds/60);
const totalHours = Math.floor(totalMinutes/60);
const totalDays = Math.floor(totalHours/24);
@@ -75,37 +75,37 @@ export class TimeService {
}
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);
// 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) ;
// 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(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=>{
this.ChatSystemService.deleteRoom(roomId)
});
}
else{
// if(this.room.t === 'p'){
// this.chatService.deleteGroup(body).subscribe(res=>{
// this.ChatSystemService.deleteRoom(roomId)
// });
// }
// else{
this.chatService.deleteChannel(body).subscribe(res=>{
this.ChatSystemService.deleteRoom(roomId)
});
}
});
}
})
return this.countDownTime;
// this.chatService.deleteChannel(body).subscribe(res=>{
// this.ChatSystemService.deleteRoom(roomId)
// });
// }
// });
// }
// })
// return this.countDownTime;
}
addZero(i) {