From 5f3a2cc20b6d3a1a030e8dd774c3165dae34719b Mon Sep 17 00:00:00 2001 From: shivbang Date: Wed, 21 Aug 2024 17:16:01 +0530 Subject: [PATCH 1/2] X2-10394 Cannot filter by date range in Purchases tab for seller (#341) * X2-10394 fixing undefined getTime * X2-10394 fixing undefined getTime * X2-10394 fixing undefined getTime * X2-10394 fixing undefined getTime * X2-10394 adding comment * X2-10394 adding comment --- src/components/DatePicker/DatePicker.jsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/DatePicker/DatePicker.jsx b/src/components/DatePicker/DatePicker.jsx index 9d4e5d1d7..1c15fe41c 100644 --- a/src/components/DatePicker/DatePicker.jsx +++ b/src/components/DatePicker/DatePicker.jsx @@ -145,7 +145,7 @@ export const DatePicker = ({ const to = toDate(now(day, timezoneName).endOf("day"), false); onChange({ from, to }, options, event); - } else if (DateUtils.isDayBefore(value.from, toDate(now(day, timezoneName)))) { + } else if (value.from && DateUtils.isDayBefore(value.from, toDate(now(day, timezoneName)))) { // this works if the user first clicked on the date that will go to "from", and the second click to "to" onChange( DateUtils.addDayToRange(toDate(now(day, timezoneName).endOf("day"), false), value), @@ -153,8 +153,9 @@ export const DatePicker = ({ event, ); } else if ( - DateUtils.isDayAfter(value.from, toDate(now(day, timezoneName))) || - DateUtils.isSameDay(value.from, toDate(now(day, timezoneName))) + value.from && + (DateUtils.isDayAfter(value.from, toDate(now(day, timezoneName))) || + DateUtils.isSameDay(value.from, toDate(now(day, timezoneName)))) ) { // this works if the user first clicked on the date that will go to "to", and the second click to "from" // also this works when the user has selected one date @@ -166,6 +167,13 @@ export const DatePicker = ({ options, event, ); + } else { + // Fallback when value.from is null + onChange( + DateUtils.addDayToRange(toDate(now(day, timezoneName).endOf("day"), false), value), + options, + event, + ); } } else { onChange(toDate(now(day, timezoneName)), options, event); From 82b7a88324680e858b1b9ea2ef5e0016c4883a8f Mon Sep 17 00:00:00 2001 From: Tanushree Chakravarty Date: Wed, 21 Aug 2024 17:33:13 +0530 Subject: [PATCH 2/2] 2.3.11 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4e8d92777..4a2601c5f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@xola/ui-kit", - "version": "2.3.10", + "version": "2.3.11", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@xola/ui-kit", - "version": "2.3.10", + "version": "2.3.11", "license": "MIT", "dependencies": { "@headlessui/react": "^1.4.0", diff --git a/package.json b/package.json index e70318fcb..8445ae064 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@xola/ui-kit", - "version": "2.3.10", + "version": "2.3.11", "description": "Xola UI Kit", "license": "MIT", "repository": {