Fix intenaldate parser

This commit is contained in:
RainLoop Team 2014-07-31 00:57:41 +04:00
parent 1de1ecc9c4
commit 7dc9441852
12 changed files with 199 additions and 184 deletions

View file

@ -1138,7 +1138,8 @@ Utils.createMomentDate = function (oObject)
return ko.computed(function () {
Globals.momentTrigger();
return this.moment().fromNow();
var oMoment = this.moment();
return 1970 === oMoment.year() ? '' : oMoment.fromNow();
}, oObject);
};
@ -1156,7 +1157,11 @@ Utils.createMomentShortDate = function (oObject)
sMomentDate = this.momentDate()
;
if (4 >= oMomentNow.diff(oMoment, 'hours'))
if (1970 === oMoment.year())
{
sResult = '';
}
else if (4 >= oMomentNow.diff(oMoment, 'hours'))
{
sResult = sMomentDate;
}
@ -2018,7 +2023,7 @@ Utils.detectDropdownVisibility = _.debounce(function () {
}, 50);
Utils.triggerAutocompleteInputChange = function (bDelay) {
var fFunc = function () {
$('.checkAutocomplete').trigger('change');
};

View file

@ -46,7 +46,7 @@ function MessageModel()
this.hasAttachments = ko.observable(false);
this.attachmentsMainType = ko.observable('');
this.moment = ko.observable(moment());
this.moment = ko.observable(moment(moment.unix(0)));
this.attachmentIconClass = ko.computed(function () {
var sClass = '';
@ -76,10 +76,6 @@ function MessageModel()
return MessageModel.calculateFullFromatDateValue(this.dateTimeStampInUTC());
}, this);
this.fullFormatDateValue = ko.computed(function () {
return MessageModel.calculateFullFromatDateValue(this.dateTimeStampInUTC());
}, this);
this.momentDate = Utils.createMomentDate(this);
this.momentShortDate = Utils.createMomentShortDate(this);
@ -140,7 +136,7 @@ MessageModel.newInstanceFromJson = function (oJsonMessage)
*/
MessageModel.calculateFullFromatDateValue = function (iTimeStampInUTC)
{
return moment.unix(iTimeStampInUTC).format('LLL');
return 0 < iTimeStampInUTC ? moment.unix(iTimeStampInUTC).format('LLL') : '';
};
/**