From ecb11f22050781c3e05fcff0a296115da5286710 Mon Sep 17 00:00:00 2001 From: Ethanm Date: Fri, 1 Jun 2018 16:14:40 +0800 Subject: [PATCH] Fixed bug with the display style of comment time --- libs/scripts/common.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/libs/scripts/common.js b/libs/scripts/common.js index 18f7467..dae4115 100644 --- a/libs/scripts/common.js +++ b/libs/scripts/common.js @@ -1,12 +1,3 @@ -function convertDateFromString(dateString) { - if (dateString) { - var arr1 = dateString.split(" "); - var sdate = arr1[0].split('-'); - var date = new Date(sdate[0], sdate[1] - 1, sdate[2]); - return date; - } -} - const padWithZeros = (vNumber, width) => { var numAsString = vNumber.toString(); while (numAsString.length < width) { @@ -26,7 +17,7 @@ const dateFormat = (date) => { } const timeAgoWithTimeStr = (dateString) => { - var date = convertDateFromString(dateString) + var date = new Date(dateString) try { var oldTime = date.getTime(); @@ -61,7 +52,7 @@ const timeAgoWithTimeStr = (dateString) => { } } catch (error) { console.log(error) - } + } } const timeAgo = (date) => {