class Cronic::Date

Defined in:

cronic/date.cr

Constant Summary

DAY_HOURS = 24
DAY_SECONDS = 86400
FORTNIGHT_DAYS = 14
FORTNIGHT_SECONDS = 1209600
MONTH_DAYS = [nil, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
MONTH_DAYS_LEAP = [nil, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
MONTH_SECONDS = 2592000
QUARTER_MONTHS = 3
QUARTER_SECONDS = 7776000
SEASON_MONTHS = 3
SEASON_SECONDS = 7862400
WEEK_DAYS = 7
WEEK_SECONDS = 604800
WEEKEND_SECONDS = 172800
YEAR_MONTHS = 12
YEAR_QUARTERS = 4
YEAR_SECONDS = 31536000

Class Method Summary

Class Method Detail

def self.could_be_day?(day, width = nil) #

Checks if given number could be day


[View source]
def self.could_be_month?(month, width = nil) #

Checks if given number could be month


[View source]
def self.could_be_year?(year, width = nil) #

Checks if given number could be year


[View source]
def self.days_in_month(year : Int32, month : Int32) #

[View source]
def self.make_year(year : Int32, bias) : Int32 #

Build a 4-digit year from a 2 digit suffix.

year - The two digit Integer year to build from. bias - The Integer amount of future years to bias.

Examples:

  make_year(96, 50) #=> 1996
  make_year(79, 20) #=> 2079
  make_year(00, 50) #=> 2000

Returns The Integer 4 digit year.


[View source]
def self.month_overflow?(year : Int32, month : Int32, day : Int32) : Bool #

[View source]