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

date: isBefore: and date: isAfter: methods AND reloadPages for contentView #243

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions JTCalendar/JTDateHelper.h
Expand Up @@ -27,6 +27,8 @@
- (BOOL)date:(NSDate *)dateA isTheSameWeekThan:(NSDate *)dateB;
- (BOOL)date:(NSDate *)dateA isTheSameDayThan:(NSDate *)dateB;

- (BOOL)date:(NSDate *)dateA isBefore:(NSDate *)dateB;
- (BOOL)date:(NSDate *)dateA isAfter:(NSDate *)dateB;
- (BOOL)date:(NSDate *)dateA isEqualOrBefore:(NSDate *)dateB;
- (BOOL)date:(NSDate *)dateA isEqualOrAfter:(NSDate *)dateB;
- (BOOL)date:(NSDate *)date isEqualOrAfter:(NSDate *)startDate andEqualOrBefore:(NSDate *)endDate;
Expand Down
18 changes: 18 additions & 0 deletions JTCalendar/JTDateHelper.m
Expand Up @@ -158,6 +158,24 @@ - (BOOL)date:(NSDate *)dateA isTheSameDayThan:(NSDate *)dateB
return componentsA.year == componentsB.year && componentsA.month == componentsB.month && componentsA.day == componentsB.day;
}

- (BOOL)date:(NSDate *)dateA isBefore:(NSDate *)dateB
{
if([dateA compare:dateB] == NSOrderedAscending) {
return YES;
}

return NO;
}

- (BOOL)date:(NSDate *)dateA isAfter:(NSDate *)dateB
{
if([dateA compare:dateB] == NSOrderedDescending) {
return YES;
}

return NO;
}

- (BOOL)date:(NSDate *)dateA isEqualOrBefore:(NSDate *)dateB
{
if([dateA compare:dateB] == NSOrderedAscending || [self date:dateA isTheSameDayThan:dateB]){
Expand Down
2 changes: 2 additions & 0 deletions JTCalendar/Protocols/JTContent.h
Expand Up @@ -22,4 +22,6 @@
- (void)loadPreviousPageWithAnimation;
- (void)loadNextPageWithAnimation;

- (void)reloadPageViews;

@end
7 changes: 7 additions & 0 deletions JTCalendar/Views/JTHorizontalCalendarView.m
Expand Up @@ -446,4 +446,11 @@ - (void)updateMenuDates
nextDate:_rightView.date];
}

- (void)reloadPageViews
{
[_leftView reload];
[_centerView reload];
[_rightView reload];
}

@end
8 changes: 8 additions & 0 deletions JTCalendar/Views/JTVerticalCalendarView.m
Expand Up @@ -445,4 +445,12 @@ - (void)updateMenuDates
currentDate:_centerView.date
nextDate:_rightView.date];
}

- (void)reloadPageViews
{
[_leftView reload];
[_centerView reload];
[_rightView reload];
}

@end