From cf08a98b9ea37c54f30cf25f60ea5397ceebd178 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Thu, 7 Dec 2017 19:49:57 +0100 Subject: [PATCH] upd: css.container|vue.container.emergency (added timestamp + date display) --- public_html/css/container.css | 10 ++++++++++ view/vue/container/emergency.vue | 25 ++++++++++++++++++++++--- 2 files changed, 32 insertions(+), 3 deletions(-) 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 //