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

2.2.0版本,默认选中时间为空,最大时间为当前时间断言问题 #32

Closed
bangjier opened this issue Apr 3, 2018 · 1 comment

Comments

@bangjier
Copy link

bangjier commented Apr 3, 2018

当我传的默认选中时间为空时,我看你self.selectDate是取的当前时间,我最大时间也是传的当前时间,如下图所示:
wechatimg10655
两个值比较结果为NSOrderedDescending
这样你下面判断@"默认选择的日期不能大于最大日期!"时就会断到这里
wechatimg10656

@agiapp
Copy link
Owner

agiapp commented Apr 3, 2018

您好,非常感谢你指出这个问题,这个bug已经修复了。
出现这个bug的原因是,在比较两个时间时没有指定比较级数(即这里应该按 yyyy-MM-dd HH:mm:ss 进行比较)
NSDate *date1 = [NSDate date];
NSDate *date2 = [NSDate date];
NSDate *date3 = [NSDate date];

不指定比较级数时,date1 < date2 < date3
指定比较级数(yyyy-MM-dd HH:mm:ss)时,date1 = date2 = date3

@agiapp agiapp closed this as completed Oct 22, 2021
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

No branches or pull requests

2 participants