Merge branch 'ent-4883-Mensaje-erroneo-WebChat' into 'develop'
Ent 4883 mensaje erroneo web chat See merge request artica/pandorafms!2856
This commit is contained in:
commit
45c57abb70
|
@ -165,9 +165,13 @@ echo "<div style='width:100%'>".html_print_button(
|
|||
check_users();
|
||||
|
||||
if (first_time) {
|
||||
var date_first_message = unix_timestamp(data['log'][0]['timestamp']);
|
||||
if(!date_first_message){
|
||||
date_first_message = unix_timestamp(new Date()/1000);
|
||||
}
|
||||
print_messages({
|
||||
0: {'type' : 'notification',
|
||||
'text': '<?php echo __('Connection established...get last 24h messages...'); ?>'}
|
||||
'text': '<?php echo __('Connection established - Retrieving messages since '); ?>'+date_first_message}
|
||||
}, true);
|
||||
first_time = false;
|
||||
}
|
||||
|
@ -308,4 +312,24 @@ echo "<div style='width:100%'>".html_print_button(
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Function to convert a timestamp to human date.
|
||||
function unix_timestamp(timestamp){
|
||||
var date = new Date(timestamp*1000);
|
||||
|
||||
const monthNames = [
|
||||
"January", "February", "March", "April",
|
||||
"May", "June", "July", "August",
|
||||
"September", "October", "November", "December"
|
||||
];
|
||||
var month = monthNames[date.getMonth()];
|
||||
|
||||
var day = date.getDate();
|
||||
var year = date.getFullYear();
|
||||
|
||||
var hour = date.getHours();
|
||||
var min = date.getMinutes();
|
||||
|
||||
return month + ' ' + day + ', '+ year + ', ' + hour+ ':' + min;
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue