diff --git a/js/views/chatview.js b/js/views/chatview.js index b13f7876184..2709dc71c8f 100644 --- a/js/views/chatview.js +++ b/js/views/chatview.js @@ -159,8 +159,8 @@ var data = _.extend({}, commentModel.attributes, { actorDisplayName: actorDisplayName, timestamp: timestamp, - date: OC.Util.relativeModifiedDate(timestamp), - altDate: OC.Util.formatDate(timestamp, 'LL LTS'), + date: moment(timestamp, 'x').diff(moment()) > -86400000 ? OC.Util.relativeModifiedDate(timestamp) : OC.Util.formatDate(timestamp, 'LT'), + altDate: OC.Util.formatDate(timestamp), formattedMessage: formattedMessage }); return data; @@ -209,7 +209,7 @@ model.set('date', new Date(model.get('timestamp') * 1000)); if (!this._lastAddedMessageModel || !this._modelsHaveSameDate(this._lastAddedMessageModel, model)) { - if (this._oldestOnTopLayout) { + if (!this._lastAddedMessageModel || this._oldestOnTopLayout) { $el.attr('data-date', this._getDateSeparator(model.get('date'))); $el.addClass('showDate'); } else { @@ -244,10 +244,10 @@ var date = moment(timestamp, 'x'), today = moment(), dayOfYear = OC.Util.formatDate(date, 'YYYY-DDD'), - dateOfToday = OC.Util.formatDate(today, 'YYYY-DDD'); + dayOfYearToday = OC.Util.formatDate(today, 'YYYY-DDD'); var relativePrefix = ''; - if (dayOfYear === dateOfToday) { + if (dayOfYear === dayOfYearToday) { relativePrefix = t('spreed', 'Today'); } else { var yesterday = OC.Util.formatDate(today.subtract(1, 'd'), 'YYYY-DDD'); @@ -260,7 +260,10 @@ } - return relativePrefix + ', ' + OC.Util.formatDate(timestamp, 'LL'); + return t('spreed', '{relativeDate}, {absoluteDate}', { + relativeDate: relativePrefix, + absoluteDate: OC.Util.formatDate(timestamp, 'LL') + }); }, _modelsHaveSameActor: function(model1, model2) {