Fix -1 year ago issue

This commit is contained in:
Pierre HUBERT 2019-02-02 10:34:50 +01:00
parent b6e818dc00
commit c819aaf716

View File

@ -21,6 +21,11 @@ ComunicWeb.common.date = {
* @return {String} The generated date * @return {String} The generated date
*/ */
diffToStr: function(difference){ diffToStr: function(difference){
//Check if difference is less than one second
if(difference < 0)
difference = 0;
//Calculate seconds //Calculate seconds
var seconds = difference-Math.floor(difference/60)*60; var seconds = difference-Math.floor(difference/60)*60;
var difference = (difference - seconds)/60; var difference = (difference - seconds)/60;