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 week number (0..53) of specified
time - 
        .week(time : VirtualTime)
        
          
Returns week number (0..53) of specified
time - 
        .week_of_year(time)
        
          
Returns current week of year.
 - 
        .weeks_in_year(time : Time)
        
          
Returns number of weeks in a year.
 
Class Method Detail
Returns number of days in current year. For a VT this is always 0 since value is not determinable
Returns current week of year.
This function returns a value in range 0..53.
Up to first 3 days of a year (Jan 1-3) may return value 0. This means they are in the new year, but technically they belong to a week that started on Monday in the previous year. Week number 53 means January 1 is on a Friday, or the year was a leap year.
The calculation is identical as the first part of Time#calendar_week.
Returns number of weeks in a year. It is calculated as number of Mondays in the year up to the ordinal date.
Thus it is possible for this function to return value of 53 (53th week in a year) for up to 4 last days in the current year.
That is, for Dec 28-31. An example of such year was 2020.
In other words, value 53 will be seen if January 1 of next year is on a Friday, or the year was a leap year.
The calculation is identical as the first part of Time#calendar_week.