select_datetime() public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File actionpack/lib/action_view/helpers/date_helper.rb, line 594
      def select_datetime
        # TODO: Remove tag conditional
        # Ideally we could just join select_date and select_date for the tag case
        if @options[:tag] && @options[:ignore_date]
          select_time
        elsif @options[:tag]
          order = date_order.dup
          order -= [:hour, :minute, :second]

          @options[:discard_year]   ||= true unless order.include?(:year)
          @options[:discard_month]  ||= true unless order.include?(:month)
          @options[:discard_day]    ||= true if @options[:discard_month] || !order.include?(:day)
          @options[:discard_minute] ||= true if @options[:discard_hour]
          @options[:discard_second] ||= true unless @options[:include_seconds] && !@options[:discard_minute]

          # If the day is hidden and the month is visible, the day should be set to the 1st so all month choices are
          # valid (otherwise it could be 31 and february wouldn't be a valid date)
          if @datetime && @options[:discard_day] && !@options[:discard_month]
            @datetime = @datetime.change(:day => 1)
          end

          [:day, :month, :year].each { |o| order.unshift(o) unless order.include?(o) }
          order += [:hour, :minute, :second] unless @options[:discard_hour]

          build_selects_from_types(order)
        else
          "#{select_date}#{@options[:datetime_separator]}#{select_time}".html_safe
        end
      end
Register or log in to add new notes.