This commit is contained in:
tiago.kayaya
2021-09-06 17:02:45 +01:00
parent 7592e7cb0e
commit 9eccabdd17
+3 -34
View File
@@ -27,6 +27,7 @@ import { EventPerson } from 'src/app/models/eventperson.model';
import { removeDuplicate } from 'src/plugin/removeDuplicate.js' import { removeDuplicate } from 'src/plugin/removeDuplicate.js'
import { environment } from 'src/environments/environment'; import { environment } from 'src/environments/environment';
import { NotificationsService } from 'src/app/services/notifications.service'; import { NotificationsService } from 'src/app/services/notifications.service';
import { TimeService } from 'src/app/services/functions/time.service';
@Component({ @Component({
selector: 'app-chat', selector: 'app-chat',
@@ -117,6 +118,7 @@ export class ChatPage implements OnInit {
private storage:Storage, private storage:Storage,
private resolver: ComponentFactoryResolver, private resolver: ComponentFactoryResolver,
private route: Router, private route: Router,
private timeService: TimeService,
){ ){
this.loggedUserChat = authService.ValidatedUserChat['data']; this.loggedUserChat = authService.ValidatedUserChat['data'];
this.headers = new HttpHeaders(); this.headers = new HttpHeaders();
@@ -416,40 +418,7 @@ hideRefreshButton(){
} }
showDateDuration(start:any){ showDateDuration(start:any){
let end; return this.timeService.showDateDuration(start);
end = new Date();
start = new Date(start);
let customizedDate;
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);
const hours = totalHours - ( totalDays * 24 );
const minutes = totalMinutes - ( totalDays * 24 * 60 ) - ( hours * 60 );
const seconds = totalSeconds - ( totalDays * 24 * 60 * 60 ) - ( hours * 60 * 60 ) - ( minutes * 60 );
if(totalDays == 0){
if(start.getDate() == new Date().getDate()){
let time = start.getHours() + ":" + this.addZero(start.getUTCMinutes());
return time;
}
else{
return 'Ontem';
}
}
else{
let date = start.getDate() + "/" + (start.getMonth()+1) + "/" + start.getFullYear();
return date;
}
}
addZero(i) {
if (i < 10) {
i = "0" + i;
}
return i;
} }
async getChatMembers(){ async getChatMembers(){