From 9d69d361fceb8b3d55866f97669cb48ea40cf468 Mon Sep 17 00:00:00 2001 From: Adhidarma Hadiwinoto <me@adhisimon.org> Date: Mon, 31 Oct 2016 21:16:07 +0700 Subject: [PATCH] momentFormat --- matrix-util.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/matrix-util.js b/matrix-util.js index 2137cf3..80e8105 100644 --- a/matrix-util.js +++ b/matrix-util.js @@ -1,6 +1,7 @@ 'use strict'; var moment = require('moment'); +var momentFormat = 'YYYY-MM-DD HH:mm:ss'; module.exports = MatrixUtil; @@ -67,7 +68,7 @@ MatrixUtil.prototype.updateBuddyState = function(jid, state, statusText, resourc matrix.buddies[jid]['resources'][resource] = { state: state, statusText: statusText, - last_update: moment().format('YYYY-MM-DD HH:mm:ss') + last_update: moment().format(momentFormat) } } catch(e) { @@ -142,7 +143,8 @@ MatrixUtil.prototype._updateLastMessage = function(partner, msg, direction) { matrix.buddies[partner]['last_' + direction] = { msg: msg, - last_update: moment().format('YYYY-MM-DD HH:mm:ss') + last_update: moment().format(momentFormat), + last_update_ts: Date.now() } } -- 1.9.0