Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove seconds for minimumDate and maximumDate that affect comparison #760

Merged
merged 13 commits into from
Feb 12, 2024

Conversation

yfyau
Copy link
Contributor

@yfyau yfyau commented Feb 6, 2024

This pull request resolves the issue where onDateChange is not triggered upon bouncing back to a valid date.
Upon reviewing the Android-side code, I identified a date comparison bug. The bug arises because selectedDate has its seconds trimmed using getFormatPattern(), while minimumDate does not undergo the same process. Consequently, a scenario like 01-02-2024 15:30:00 < 01-02-2024 15:30:45 occurs, causing the following condition to always evaluate as false and preventing the code from reaching the Emitter.onDateChange line.

Calendar minDate = state.getMinimumDate();
if (minDate != null && selectedDate.before(minDate)) {
uiManager.animateToDate(minDate);
return;
}

@yfyau yfyau changed the title Remove seconds for minimumDate and maximumDate that affect comparison Remove seconds for minimumDate and maximumDate that affect comparison Feb 6, 2024
@henninghall
Copy link
Owner

Thanks for the PR! Since this is an issue only on android, I moved the code to the android specific component. Also added a test for this.

@henninghall henninghall merged commit 0151e2c into henninghall:master Feb 12, 2024
6 checks passed
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.

2 participants