From 880544edc233f740f90d723d0c298c562e9ffb9b Mon Sep 17 00:00:00 2001 From: asundukov Date: Tue, 26 Jul 2022 11:27:35 +0300 Subject: [PATCH] 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;