Module: Zakuro::Calculation::Monthly::DateComparer
- Defined in:
- lib/zakuro/calculation/monthly/internal/date_comparer.rb
Overview
DateComparer 日付比較
Class Method Summary collapse
-
.include?(date:, start_date:, last_date:) ⇒ True, False
範囲内か.
-
.include_by_japan_date?(date:, gengou:, month_label:) ⇒ True, False
範囲内か.
Class Method Details
.include?(date:, start_date:, last_date:) ⇒ True, False
範囲内か
24 25 26 27 28 29 30 31 32 |
# File 'lib/zakuro/calculation/monthly/internal/date_comparer.rb', line 24 def include?(date:, start_date:, last_date:) return false if start_date.invalid? return false if date < start_date return false if date > last_date true end |
.include_by_japan_date?(date:, gengou:, month_label:) ⇒ True, False
範囲内か
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/zakuro/calculation/monthly/internal/date_comparer.rb', line 44 def include_by_japan_date?(date:, gengou:, month_label:) linear_gengou = gengou.match_by_name(name: date.gengou) return false if linear_gengou.invalid? return false unless linear_gengou.name == date.gengou return false unless linear_gengou.year == date.year same_by_japan_date?(month_label: month_label, date: date) end |