lib/repeatable/expression/range_in_year.rb in repeatable-0.5.0 vs lib/repeatable/expression/range_in_year.rb in repeatable-0.6.0
- old
+ new
@@ -7,10 +7,16 @@
@start_day = start_day
@end_day = end_day
end
def include?(date)
- months_include?(date) || start_month_include?(date) || end_month_include?(date)
+ return true if months_include?(date)
+
+ if start_month == end_month
+ start_month_include?(date) && end_month_include?(date)
+ else
+ start_month_include?(date) || end_month_include?(date)
+ end
end
def to_h
args = { start_month: start_month }
args[:end_month] = end_month unless end_month == start_month