Skip to content

Commit

Permalink
- Made DTTimePeriod inheritable
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew York committed Sep 26, 2016
1 parent 26d1d26 commit 682c271
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions DateTools/DTTimePeriod.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ -(instancetype)initWithStartDate:(NSDate *)startDate endDate:(NSDate *)endDate{
* @return DTTimePeriod - new instance
*/
+(instancetype)timePeriodWithStartDate:(NSDate *)startDate endDate:(NSDate *)endDate{
return [[DTTimePeriod alloc] initWithStartDate:startDate endDate:endDate];
return [[self.class alloc] initWithStartDate:startDate endDate:endDate];
}

/**
Expand All @@ -70,7 +70,7 @@ +(instancetype)timePeriodWithStartDate:(NSDate *)startDate endDate:(NSDate *)end
* @return DTTimePeriod - new instance
*/
+(instancetype)timePeriodWithSize:(DTTimePeriodSize)size startingAt:(NSDate *)date{
return [[DTTimePeriod alloc] initWithStartDate:date endDate:[DTTimePeriod dateWithAddedTime:size amount:1 baseDate:date]];
return [[self.class alloc] initWithStartDate:date endDate:[DTTimePeriod dateWithAddedTime:size amount:1 baseDate:date]];
}

/**
Expand All @@ -84,7 +84,7 @@ +(instancetype)timePeriodWithSize:(DTTimePeriodSize)size startingAt:(NSDate *)da
* @return DTTimePeriod - new instance
*/
+(instancetype)timePeriodWithSize:(DTTimePeriodSize)size amount:(NSInteger)amount startingAt:(NSDate *)date{
return [[DTTimePeriod alloc] initWithStartDate:date endDate:[DTTimePeriod dateWithAddedTime:size amount:amount baseDate:date]];
return [[self.class alloc] initWithStartDate:date endDate:[DTTimePeriod dateWithAddedTime:size amount:amount baseDate:date]];
}

/**
Expand All @@ -97,7 +97,7 @@ +(instancetype)timePeriodWithSize:(DTTimePeriodSize)size amount:(NSInteger)amoun
* @return DTTimePeriod - new instance
*/
+(instancetype)timePeriodWithSize:(DTTimePeriodSize)size endingAt:(NSDate *)date{
return [[DTTimePeriod alloc] initWithStartDate:[DTTimePeriod dateWithSubtractedTime:size amount:1 baseDate:date] endDate:date];
return [[self.class alloc] initWithStartDate:[DTTimePeriod dateWithSubtractedTime:size amount:1 baseDate:date] endDate:date];
}

/**
Expand All @@ -111,7 +111,7 @@ +(instancetype)timePeriodWithSize:(DTTimePeriodSize)size endingAt:(NSDate *)date
* @return DTTimePeriod - new instance
*/
+(instancetype)timePeriodWithSize:(DTTimePeriodSize)size amount:(NSInteger)amount endingAt:(NSDate *)date{
return [[DTTimePeriod alloc] initWithStartDate:[DTTimePeriod dateWithSubtractedTime:size amount:amount baseDate:date] endDate:date];
return [[self.class alloc] initWithStartDate:[DTTimePeriod dateWithSubtractedTime:size amount:amount baseDate:date] endDate:date];
}

/**
Expand All @@ -121,7 +121,7 @@ +(instancetype)timePeriodWithSize:(DTTimePeriodSize)size amount:(NSInteger)amoun
* @return DTTimePeriod - new instance
*/
+(instancetype)timePeriodWithAllTime{
return [[DTTimePeriod alloc] initWithStartDate:[NSDate distantPast] endDate:[NSDate distantFuture]];
return [[self.class alloc] initWithStartDate:[NSDate distantPast] endDate:[NSDate distantFuture]];
}

/**
Expand Down

0 comments on commit 682c271

Please sign in to comment.