From 3e60c23434d9870bf74e8087ced42e1d1833c188 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Mon, 16 Dec 2024 15:53:08 +0800 Subject: [PATCH] * [refac bug #57903] Check delay is or not for assigntomeblock. --- module/block/js/assigntomeblock.ui.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/module/block/js/assigntomeblock.ui.js b/module/block/js/assigntomeblock.ui.js index 33537356ed..292a627503 100644 --- a/module/block/js/assigntomeblock.ui.js +++ b/module/block/js/assigntomeblock.ui.js @@ -35,17 +35,22 @@ window.renderCell = function(result, info) { if(info.col.name == 'deadline' && result[0]) { - const today = zui.formatDate(zui.createDate(), 'yyyy-MM-dd'); + const current = zui.createDate(); + const year = zui.formatDate(current, 'yyyy'); + const today = zui.formatDate(current, 'yyyy-MM-dd'); const yesterday = zui.formatDate(convertStringToDate(today) - 24 * 60 * 60 * 1000, 'yyyy-MM-dd'); - if(result[0] == today) + + let deadline = result[0]; + if(deadline.split('-').length == 2) deadline = year + '-' + deadline; + if(deadline == today) { result[0] = {html: '' + todayLabel + ''}; } - else if(result == yesterday) + else if(deadline == yesterday) { result[0] = {html: '' + yesterdayLabel + ''}; } - else if(result < yesterday) + else if(deadline < yesterday) { result[0] = {html: '' + result + ''}; }