diff --git a/pandora_console/operation/users/webchat.php b/pandora_console/operation/users/webchat.php
index de59c5d3e8..809ccaa000 100644
--- a/pandora_console/operation/users/webchat.php
+++ b/pandora_console/operation/users/webchat.php
@@ -165,9 +165,13 @@ echo "
".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': ''}
+ 'text': ''+date_first_message}
}, true);
first_time = false;
}
@@ -308,4 +312,24 @@ echo "
".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;
+ }