lib/holidays/core_extensions/time.rb
module Holidays module CoreExtensions module Time def self.included(base) base.extend ClassMethods end module ClassMethods COMMON_YEAR_DAYS_IN_MONTH = [nil, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] # Returns the number of days in the given month. # If no year is specified, it will use the current year. def days_in_month(month, year = current.year) if month == 2 && ::Date.gregorian_leap?(year) 29 else COMMON_YEAR_DAYS_IN_MONTH[month] end end end end end end
Source Files
- lib/generated_definitions/REGIONS.rb
- lib/generated_definitions/ar.rb
- lib/generated_definitions/at.rb
- lib/generated_definitions/au.rb
- lib/generated_definitions/be.rb
- lib/generated_definitions/be_fr.rb
- lib/generated_definitions/be_nl.rb
- lib/generated_definitions/bg.rb
- lib/generated_definitions/br.rb
- lib/generated_definitions/ca.rb
- lib/generated_definitions/ch.rb
- lib/generated_definitions/cl.rb
- lib/generated_definitions/co.rb
- lib/generated_definitions/cr.rb
- lib/generated_definitions/cz.rb
- lib/generated_definitions/de.rb
- lib/generated_definitions/dk.rb
- lib/generated_definitions/ecbtarget.rb
- lib/generated_definitions/ee.rb
- lib/generated_definitions/el.rb
- lib/generated_definitions/es.rb
- lib/generated_definitions/europe.rb
- lib/generated_definitions/federalreserve.rb
- lib/generated_definitions/federalreservebanks.rb
- lib/generated_definitions/fedex.rb
- lib/generated_definitions/fi.rb
- lib/generated_definitions/fr.rb
- lib/generated_definitions/gb.rb
- lib/generated_definitions/ge.rb
- lib/generated_definitions/hk.rb
- lib/generated_definitions/hr.rb
- lib/generated_definitions/hu.rb
- lib/generated_definitions/ie.rb
- lib/generated_definitions/is.rb
- lib/generated_definitions/it.rb
- lib/generated_definitions/jp.rb
- lib/generated_definitions/kr.rb
- lib/generated_definitions/kz.rb
- lib/generated_definitions/li.rb
- lib/generated_definitions/lt.rb
- lib/generated_definitions/lu.rb
- lib/generated_definitions/lv.rb
- lib/generated_definitions/ma.rb
- lib/generated_definitions/mt_en.rb
- lib/generated_definitions/mt_mt.rb
- lib/generated_definitions/mx.rb
- lib/generated_definitions/my.rb
- lib/generated_definitions/nerc.rb
- lib/generated_definitions/ng.rb
- lib/generated_definitions/nl.rb
- lib/generated_definitions/no.rb
- lib/generated_definitions/northamerica.rb
- lib/generated_definitions/nyse.rb
- lib/generated_definitions/nz.rb
- lib/generated_definitions/pe.rb
- lib/generated_definitions/ph.rb
- lib/generated_definitions/pl.rb
- lib/generated_definitions/pt.rb
- lib/generated_definitions/ro.rb
- lib/generated_definitions/rs_cyrl.rb
- lib/generated_definitions/rs_la.rb
- lib/generated_definitions/ru.rb
- lib/generated_definitions/scandinavia.rb
- lib/generated_definitions/se.rb
- lib/generated_definitions/sg.rb
- lib/generated_definitions/si.rb
- lib/generated_definitions/sk.rb
- lib/generated_definitions/southamerica.rb
- lib/generated_definitions/th.rb
- lib/generated_definitions/tn.rb
- lib/generated_definitions/tr.rb
- lib/generated_definitions/ua.rb
- lib/generated_definitions/unitednations.rb
- lib/generated_definitions/ups.rb
- lib/generated_definitions/us.rb
- lib/generated_definitions/ve.rb
- lib/generated_definitions/vi.rb
- lib/generated_definitions/za.rb
- lib/holidays.rb
- lib/holidays/core_extensions/date.rb
- lib/holidays/core_extensions/time.rb
- lib/holidays/date_calculator/day_of_month.rb
- lib/holidays/date_calculator/easter.rb
- lib/holidays/date_calculator/lunar_date.rb
- lib/holidays/date_calculator/weekend_modifier.rb
- lib/holidays/definition/context/function_processor.rb
- lib/holidays/definition/context/generator.rb
- lib/holidays/definition/context/load.rb
- lib/holidays/definition/context/merger.rb
- lib/holidays/definition/decorator/custom_method_proc.rb
- lib/holidays/definition/decorator/custom_method_source.rb
- lib/holidays/definition/decorator/test.rb
- lib/holidays/definition/entity/custom_method.rb
- lib/holidays/definition/entity/test.rb
- lib/holidays/definition/generator/module.rb
- lib/holidays/definition/generator/regions.rb
- lib/holidays/definition/generator/test.rb
- lib/holidays/definition/parser/custom_method.rb
- lib/holidays/definition/parser/test.rb
- lib/holidays/definition/repository/cache.rb
- lib/holidays/definition/repository/custom_methods.rb
- lib/holidays/definition/repository/holidays_by_month.rb
- lib/holidays/definition/repository/proc_result_cache.rb
- lib/holidays/definition/repository/regions.rb
- lib/holidays/definition/validator/custom_method.rb
- lib/holidays/definition/validator/region.rb
- lib/holidays/definition/validator/test.rb
- lib/holidays/errors.rb
- lib/holidays/factory/date_calculator.rb
- lib/holidays/factory/definition.rb
- lib/holidays/factory/finder.rb
- lib/holidays/finder/context/between.rb
- lib/holidays/finder/context/dates_driver_builder.rb
- lib/holidays/finder/context/next_holiday.rb
- lib/holidays/finder/context/parse_options.rb
- lib/holidays/finder/context/search.rb
- lib/holidays/finder/context/year_holiday.rb
- lib/holidays/finder/rules/in_region.rb
- lib/holidays/finder/rules/year_range.rb
- lib/holidays/load_all_definitions.rb
- lib/holidays/version.rb