module
VirtualTime::TimeHelper
Defined in:
virtualtime.crClass Method Summary
-
.day_of_week(time : Time)
Returns day of week of specified
time -
.day_of_week(time : VirtualTime)
Returns day of week of specified
time -
.day_of_year(time)
Returns day of year of specified
time -
.days_in_month(time : Time)
Returns number of days in month of specified
time -
.days_in_month(time : VirtualTime)
Returns number of days in month of specified
time -
.days_in_year(time : Time)
Returns number of days in current year
-
.days_in_year(time : VirtualTime)
Returns number of days in current year.
-
.week(time : Time)
Returns ISO week number (1..53) of specified
time -
.week(time : VirtualTime)
Returns ISO week number (1..53) of specified
time -
.week_of_year(time)
Returns the week of the year
timefalls in, counted within that calendar year rather than within the ISO year. -
.weeks_in_year(time : Time)
Returns the number of weeks (52 or 53) in the ISO year that
timefalls in.
Class Method Detail
Returns number of days in current year. For a VT this is always 0 since value is not determinable
Returns the week of the year time falls in, counted within that
calendar year rather than within the ISO year.
This function returns a value in range 0..53. Up to the first 3 days of a year (Jan 1-3) may return value 0, meaning they are in the new calendar year but belong to a week that started on Monday in the previous one.
NOTE matching (and therefore VirtualTime#week) uses .week instead,
which is the ISO week and numbers those same days 52 or 53, never 0.
Returns the number of weeks (52 or 53) in the ISO year that time falls in.
Note that this is the ISO year, which is what Time#calendar_week (and
therefore .week) counts weeks within: the first days of January can
still belong to the previous ISO year, and the last days of December to
the next one.
A year has 53 weeks when it begins on a Thursday, or when it is a leap year beginning on a Wednesday. 2020 was such a year.