Class: DateCalculator

Inherits:
Object
  • Object
show all
Defined in:
lib/releases/date_calculator.rb

Constant Summary collapse

RELEASE_VERSION =

Represents the minimum version that uses the new release date

'16.6'
RELEASE_DATE =

Represents the minimum date that uses the new release date

Date.parse('2023-11-16')

Instance Method Summary collapse

Constructor Details

#initialize(next_version:, candidate_date:) ⇒ DateCalculator

the first day of the month.

Parameters:

  • version (ReleaseVersion)
  • candidate_date (Date)
    • The month to calculate the release date. It should be



15
16
17
18
# File 'lib/releases/date_calculator.rb', line 15

def initialize(next_version:, candidate_date:)
  @next_version = next_version
  @candidate_date = candidate_date
end

Instance Method Details

#executeObject



20
21
22
23
24
25
26
27
28
# File 'lib/releases/date_calculator.rb', line 20

def execute
  result_date = if before_new_release_date?
                  twenty_second_of_the_month
                else
                  calculate_third_thursday_of_month
                end

  result_date.strftime('%Y-%m-%d')
end