Module: Inq::DateTimeHelpers

Included in:
Sources::Github::IssueFetcher, Sources::Github::Issues
Defined in:
lib/inq/date_time_helpers.rb

Overview

Various helper functions for working with DateTime objects.

Instance Method Summary collapse

Instance Method Details

#date_ge(left, right) ⇒ Boolean

Check if left is greater than or equal to right, where both are string representations of a date.

Parameters:

  • left (String)

    A string representation of a date.

  • right (String)

    A string representation of a date.

Returns:

  • (Boolean)

    True if left is greater-than-or-equal to right, otherwise false.



31
32
33
34
35
36
# File 'lib/inq/date_time_helpers.rb', line 31

def date_ge(left, right)
  left  = str_to_dt(left)
  right = str_to_dt(right)

  left >= right
end

#date_le(left, right) ⇒ Boolean

Check if left is less than or equal to right, where both are string representations of a date.

Parameters:

  • left (String)

    A string representation of a date.

  • right (String)

    A string representation of a date.

Returns:

  • (Boolean)

    True if left is less-than-or-equal to right, otherwise false.



17
18
19
20
21
22
# File 'lib/inq/date_time_helpers.rb', line 17

def date_le(left, right)
  left  = str_to_dt(left)
  right = str_to_dt(right)

  left <= right
end