This commit is contained in:
tiago.kayaya
2021-08-20 17:00:48 +01:00
parent 2b21af3511
commit f1aa56bf4a
4 changed files with 80 additions and 2 deletions
@@ -126,6 +126,43 @@ export class MessagesPage implements OnInit, AfterViewChecked {
});
}
showDateDuration(start:any){
let end;
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 openMessagesOptions(ev?: any) {
const popover = await this.popoverController.create({
component: MessagesOptionsPage,