Skip to content

Commit 682c271

Browse files
author
Matthew York
committed
- Made DTTimePeriod inheritable
1 parent 26d1d26 commit 682c271

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

DateTools/DTTimePeriod.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ -(instancetype)initWithStartDate:(NSDate *)startDate endDate:(NSDate *)endDate{
5757
* @return DTTimePeriod - new instance
5858
*/
5959
+(instancetype)timePeriodWithStartDate:(NSDate *)startDate endDate:(NSDate *)endDate{
60-
return [[DTTimePeriod alloc] initWithStartDate:startDate endDate:endDate];
60+
return [[self.class alloc] initWithStartDate:startDate endDate:endDate];
6161
}
6262

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

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

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

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

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

127127
/**

0 commit comments

Comments
 (0)