Skip to content

Fix #4076: Trigger onCalendarClose event and onChange even when the same date is selected as the start and the end date in a date range#8

Merged
balajis-qb merged 6 commits intomainfrom
issue-4076/fix/emit-onCalendarClose-onsame-range-select
Jan 16, 2024
Merged

Fix #4076: Trigger onCalendarClose event and onChange even when the same date is selected as the start and the end date in a date range#8
balajis-qb merged 6 commits intomainfrom
issue-4076/fix/emit-onCalendarClose-onsame-range-select

Conversation

@balajis-qb
Copy link
Copy Markdown
Collaborator

Closes: Hacker0x01#4076

This ticket fixes the following issues

  1. Previously we were checking whether to emit the onCalendarClose close or not using the isBefore function but the issue is the startDate has the default time added, but the endDate we get from the calendar component doesn't have any time added to it, hence the isBefore check was failing as the startDate with some time is always ahead of the same date (endDate) without time
    2. Similarly we were using the same isBefore function to decide whether to consider the date as startDate or endDate for onChange event handler, as the isBefore will fail because of the few milli-sec difference and the onChange call will fail. As a result, the end date (the currently selected date) is being considered as the startDate, hence we need to once again select the endDate value

I fixed the above issues by only comparing the date and not considering the time.

@balajis-qb balajis-qb force-pushed the issue-4076/fix/emit-onCalendarClose-onsame-range-select branch from e4e9afb to a539b10 Compare November 28, 2023 10:37
…selected for a date range

This commit resolves the following issue
1. Previously we were checking whether to emit the onCalendarClose close or not using the isBefore function but the issue is the startDate has the default time added, but the endDate we get from the calendar component doesn't has any time added to it, hence the isBefore check was failing as the startDate with some time is always ahead of the same date (endDate) without time
2. Similarly we were using the same isBefore function to decide whether to consider the date as startDate or endDate for onChange event handler, as the isBefore will fail because of the few milli-sec difference and the onChange call will fail.  As a result the end date (the currently selected date) is being considered as the startDate, hence we need to once again select the endDate value

Closes: Hacker0x01#4076
@balajis-qb balajis-qb force-pushed the issue-4076/fix/emit-onCalendarClose-onsame-range-select branch from a539b10 to e3d65b2 Compare November 28, 2023 10:42
@balajis-qb balajis-qb merged commit 41713cf into main Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

onCalendarClose is not called when selecting the same day as start&end date in selectsRange mode

1 participant