struct TCal::TimePeriod
- TCal::TimePeriod
- TCal::Period(Time)
- Struct
- Value
- Object
Overview
An interval between two Time
.
Defined in:
t_cal/period/time_period.crConstant Summary
-
EARLY_HOUR =
7
-
LATE_HOUR =
22
Constructors
Instance Method Summary
-
#all_day : self
Returns a period that starts and ends at midnight on the same dates as this one.
-
#each_month : Iterator(Time)
Iterates over each month in the interval,
#at_beginning_of_month
. -
#each_sunday_week : Iterator(Time)
Iterates over each week in the interval,
#at_beginning_of_sunday_week
. -
#snap_to_midnight : self
If this period's
start
orend
fall within the period fromLATE_HOUR
toEARLY_HOUR
, returns a new period with the offending field(s) set to midnight. -
#split_at_sunday : Array(self)
Splits this period at Saturday/Sunday boundaries.
-
#to_date_period : DatePeriod
Converts this period to a
DatePeriod
, discarding the time information.
Instance methods inherited from struct TCal::Period(Time)
end : T
end,
start : T
start
Constructor methods inherited from struct TCal::Period(Time)
new(start : T, end __arg0 : T)
new
Class methods inherited from struct TCal::Period(Time)
merge(periods : Array(U)) : Array(U) forall U
merge
Constructor Detail
Instance Method Detail
Returns a period that starts and ends at midnight on the same dates as this one. If any part of the end date is covered, the resulting period will cover the entire day, ending at midnight of the next day.
Iterates over each month in the interval, #at_beginning_of_month
.
Includes the months containing both the start and end of the interval.
Note since the end time is exclusive, if it is exactly at the beginning
of a month, that month will not be included.
Iterates over each week in the interval, #at_beginning_of_sunday_week
.
Includes the weeks containing both the start and end of the interval.
Note since the end time is exclusive, if it is exactly at the beginning
of a week, that week will not be included.
If this period's start
or end
fall within the period from LATE_HOUR
to EARLY_HOUR
, returns a new period with the offending field(s) set to
midnight.
If this would result in an empty period, instead returns self
.
Converts this period to a DatePeriod
, discarding the time information.