From f02bdffc4c9c14695b5d34b79cebcae72f688939 Mon Sep 17 00:00:00 2001 From: asundukov Date: Mon, 25 Jul 2022 23:09:35 +0300 Subject: [PATCH 1/2] fix: function DATEDIF --- src/function/functionImplementation.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/function/functionImplementation.js b/src/function/functionImplementation.js index 2ea9319..73157ee 100644 --- a/src/function/functionImplementation.js +++ b/src/function/functionImplementation.js @@ -12451,9 +12451,8 @@ const functionImplementation = { } try { - luckysheet_getValue(arguments); for (var i = 0; i < arguments.length-1; i++){ - arguments[i] = moment.fromOADate(arguments[i]).format("l"); + arguments[i] = func_methods.getCellDate(arguments[i]); if(!isdatetime(arguments[i])){ return formula.error.v; } From 880544edc233f740f90d723d0c298c562e9ffb9b Mon Sep 17 00:00:00 2001 From: asundukov Date: Tue, 26 Jul 2022 11:27:35 +0300 Subject: [PATCH 2/2] fix: function DATEDIF. Unit="YD" returns NaN --- src/function/functionImplementation.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/function/functionImplementation.js b/src/function/functionImplementation.js index 73157ee..75ce582 100644 --- a/src/function/functionImplementation.js +++ b/src/function/functionImplementation.js @@ -12485,8 +12485,9 @@ const functionImplementation = { result = (startM <= endM) ? endM - startM : endM + 12 - startM; break; case "YD":case "yd": - var startM = genarate(startDate.format('MM-DD'))[2]; - var endM = genarate(endDate.format('MM-DD'))[2]; + const format = `${endDate.$y}-MM-DD`; + var startM = genarate(startDate.format(format))[2]; + var endM = genarate(endDate.format(format))[2]; result = (startM <= endM) ? endM - startM : endM + 365 - startM; break;