summaryrefslogtreecommitdiff
path: root/qa/qa/support/dates.rb
blob: 9e791bc11c516ff94cc0c1dcc3131cf998d4c590 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# frozen_string_literal: true

module QA
  module Support
    module Dates
      def current_date_yyyy_mm_dd
        current_date.strftime("%Y/%m/%d")
      end

      def next_month_yyyy_mm_dd
        current_date.next_month.strftime("%Y/%m/%d")
      end

      def thirteen_days_from_now_yyyy_mm_dd
        (current_date + 13).strftime("%Y/%m/%d")
      end

      def format_date(date)
        new_date = DateTime.strptime(date, "%Y/%m/%d")
        new_date.strftime("%b %-d, %Y")
      end

      private

      def current_date
        DateTime.now
      end
    end
  end
end