lib/after_ship/core/date_utils.rb
# Try to parse a date or datetime from a string.
#
# @param value [String]
#   Empty String,
#   YYYY-MM-DD,
#   YYYY-MM-DDTHH:MM:SS,
#   YYYY-MM-DDTHH:MM:SSZ,
#   YYYY-MM-DDTHH:MM:SS+HH:MM or
#   YYYY-MM-DDTHH:MM:SS-HH:MM.
#
Try to parse a date or datetime from a string.
Try to parse a date or datetime from a string .
def parse(value)
      case value
      when '', nil
        nil
      when DATE_PLAIN_REGEX, DATE_REGEX
        Date.parse(value)
      when DATETIME_REGEX, DATETIME_WITH_ZONE_REGEX
        DateTime.parse(value)
      else
        fail ArgumentError, "Invalid expected_delivery date #{value.inspect}"
      end
    end
def parse ( value ) case value when '' , nil nil when DATE_PLAIN_REGEX , DATE_REGEX Date . parse ( value ) when DATETIME_REGEX , DATETIME_WITH_ZONE_REGEX DateTime . parse ( value ) else fail ArgumentError , "Invalid expected_delivery date #{value.inspect}" end end
Try to parse a date or datetime from a string.
Try to parse a date or datetime from a string .
value
None