From ad58b1d45eb5f56c915accf7e10055a40b7ed5c3 Mon Sep 17 00:00:00 2001 From: Yusuf-YENICERI Date: Wed, 18 Dec 2024 00:12:30 +0300 Subject: [PATCH] =?UTF-8?q?B=C4=B0SM=C4=B0LLAH=C4=B0RRAHMAN=C4=B0RRAH?= =?UTF-8?q?=C4=B0M=20=20=20dates=20fixed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/common.js b/src/common.js index a858831..5f1145e 100644 --- a/src/common.js +++ b/src/common.js @@ -168,7 +168,24 @@ const getCurrentIndexV3 = hatims => { }; const getMonths3Date = () => { - const data = dataMonths3[new Date ().getFullYear ()]; + let data = dataMonths3[new Date ().getFullYear ()]; + + if (data.double) { + let endOfYear = new Date (data.startingDate2); + endOfYear.setDate (endOfYear.getDate () + 90); + + if (new Date () > endOfYear) { + data = dataMonths3[new Date ().getFullYear () + 1]; + } + } else { + let endOfYear = new Date (data.startingDate); + endOfYear.setDate (endOfYear.getDate () + 90); + + if (new Date () > endOfYear) { + data = dataMonths3[new Date ().getFullYear () + 1]; + } + } + if (data.double) { if (new Date () < new Date (data.startingDate2)) { data.chosen = 1;