Sha256: 5eaafc7c8c50fe1da40a66368117cd3c6d50ff6ce010f49a8283eef98ed49d4c
Contents?: true
Size: 573 Bytes
Versions: 9
Compression:
Stored size: 573 Bytes
Contents
# frozen_string_literal: true module RailsCoreExtensions module DateTime def advance_considering_calendar(units, num_units) case units when :seconds, :minutes, :hours, :days, :weeks, :months, :years advance(units => num_units) when :calendar_days advance(days: num_units - 1).end_of_day when :calendar_months advance(months: num_units - 1).end_of_month when :calendar_years advance(years: num_units - 1).end_of_year end end end end class DateTime include RailsCoreExtensions::DateTime end
Version data entries
9 entries across 9 versions & 1 rubygems