From ca89a7cf1036b052d2a55c8ec245d0df1238ad31 Mon Sep 17 00:00:00 2001 From: elraphty Date: Mon, 13 Jan 2025 11:44:25 +0100 Subject: [PATCH] fix: cypress test --- cypress/e2e/50_adminCustomDateSelect.cy.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cypress/e2e/50_adminCustomDateSelect.cy.ts b/cypress/e2e/50_adminCustomDateSelect.cy.ts index 3d4a7b31..b76e41c8 100644 --- a/cypress/e2e/50_adminCustomDateSelect.cy.ts +++ b/cypress/e2e/50_adminCustomDateSelect.cy.ts @@ -58,10 +58,18 @@ describe('Admin Statistics Custom Date Range', () => { cy.contains('25').should('exist'); cy.wait(1000); - const expectedStartDateFormat = `${String(startDate.getDate()).padStart( + let expectedStartDateFormat = `${String(startDate.getDate()).padStart( 2, '0' )} ${startDate.toLocaleString('default', { month: 'short' })}`; + + if (startDate.getMonth() === 0) { + expectedStartDateFormat = `${String(startDate.getDate()).padStart( + 2, + '0' + )} ${startDate.toLocaleString('default', { month: 'short' })} ${endDate.getFullYear()}`; + } + const expectedEndDateFormat = `${String(endDate.getDate()).padStart( 2, '0'