ESDatesToRangeConverter Class Reference
Inherits from | NSObject |
Declared in | ESDatesToRangeConverter.h ESDatesToRangeConverter.mm |
Overview
A class to convert the date to NSRange. It can be useful to build timeline selection GUI components.
It supports the following resolutions
- day
- week
- month
- quarter
- half year
- year
Note : The dates must be aligned to a given resolution
Tasks
-
– initWithTimelineStartDate:timelineEndDate:locale:
-
startDate
property -
endDate
property -
resolution
property -
– getTimelineRange
Properties
endDate
An end date of the selected timeline range.
@property (nonatomic) NSDate *endDate
Declared In
ESDatesToRangeConverter.h
Instance Methods
getTimelineRange
Calculates the sub-range of the start and end date in given units.
- (NSRange)getTimelineRange
Return Value
A sub-range for the given dates and resolution.
Discussion
result.location = (startDate - globalBegin_) / resolution
result.length = (endDate - startDate) / resolution
Declared In
ESDatesToRangeConverter.h
initWithTimelineStartDate:timelineEndDate:locale:
A designated initializer. Note : dates must be aligned to a given resolution
- (instancetype)initWithTimelineStartDate:(NSDate *)globalBegin_ timelineEndDate:(NSDate *)globalEnd_ locale:(NSLocale *)locale_
Parameters
- globalBegin_
The beginning of a timeline range.
- globalEnd_
The end of a timeline range.
- locale_
The locale for calendar computations. Note : It will have the highest impact on week calculations.
Return Value
A properly initialized ESDatesToRangeConverter object.
Declared In
ESDatesToRangeConverter.h