diff --git a/public_html/css/container.css b/public_html/css/container.css index 677801b..0195799 100644 --- a/public_html/css/container.css +++ b/public_html/css/container.css @@ -58,6 +58,16 @@ display: none; } + #CONTAINER.message div span.date{ /* Message date */ + display: block; + position: relative; + + margin-top: 1em; + + color: #888; + font-size: .8em; + } + #CONTAINER.message div span span.code{ /* Code block */ display: inline-block; position: relative; diff --git a/view/vue/container/emergency.vue b/view/vue/container/emergency.vue index 1a008d5..89fea23 100644 --- a/view/vue/container/emergency.vue +++ b/view/vue/container/emergency.vue @@ -2,9 +2,10 @@
-
- - +
+ + +
@@ -25,6 +26,24 @@ export default { name: 'CONTAINER_EMERGENCY', data(){ return { gstore: gstore.data }; }, methods: { + local_date: function(id){ + /* (1) Get current date */ + var cur = new Date( gstore.data.notif.emergency.data[id].timestamp ); + console.log(cur); + + /* (2) First line -> show whole date */ + if( id < 1 ) + return cur.toLocaleString(); + + /* (3) Get previous date */ + var pre = new Date( gstore.data.notif.emergency.data[id-1].timestamp ); + + /* (2) If same day -> show time only */ + if( cur.toLocaleDateString() == pre.toLocaleDateString() ) + return cur.toLocaleTimeString(); + + return cur.toLocaleString(); + }, new_message(msg){ // {1} Send message //