From 6d162708767af3163cdb4ab6e169d6f126f15d03 Mon Sep 17 00:00:00 2001 From: Angela Mazzurco Date: Tue, 6 Jun 2017 15:55:52 +0200 Subject: [PATCH] Create function to set date format from recv_time --- retroshare-qml-app/src/GxsIdentityDelegate.qml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/retroshare-qml-app/src/GxsIdentityDelegate.qml b/retroshare-qml-app/src/GxsIdentityDelegate.qml index e80577af7..c7d6c4116 100644 --- a/retroshare-qml-app/src/GxsIdentityDelegate.qml +++ b/retroshare-qml-app/src/GxsIdentityDelegate.qml @@ -202,6 +202,20 @@ Item var id= ChatCache.lastMessageCache.getChatIdFromGxs(model.gxs_id) return ChatCache.lastMessageCache.getChatIdFromGxs(model.gxs_id) } + function setTime(){ + if (!lastMessageData.recv_time){ + return "" + } + var timeFormat = "dd.MM.yyyy"; + var recvDate = new Date(lastMessageData.recv_time*1000) + + // Check if is today + if ( new Date (lastMessageData.recv_time*1000).setHours(0,0,0,0) == new Date ().setHours(0,0,0,0)) { + timeFormat = "hh:mm" + } + var timeString = Qt.formatDateTime(recvDate, timeFormat) + return timeString + } function showDetails() {