Sha256: 8161d72269789aa07446a3341be6126a20cfa3d8019982fe4d593fd2d6978592

Contents?: true

Size: 1010 Bytes

Versions: 39

Compression:

Stored size: 1010 Bytes

Contents

# frozen_string_literal: true

module Playbook
  module PbDate
    class Date
      include ActionView::Helpers::TagHelper
      include ActionView::Context
      include Playbook::Props

      partial "pb_date/date"

      prop :date, required: true
      prop :size, type: Playbook::Props::Enum,
                  values: %w[lg sm xs],
                  default: "sm"
      prop :timezone, default: "America/New_York"

      def classname
        generate_classname("pb_date_kit")
      end

      def xs_date
        "#{pb_date_time.to_day_of_week.upcase} · #{pb_date_time.to_month.upcase} #{pb_date_time.to_day}".html_safe
      end

      def lg_date
        "#{pb_date_time.to_month.upcase} #{pb_date_time.to_day}"
      end

      def sm_date
        "#{pb_date_time.to_day_of_week.upcase} · #{pb_date_time.to_month.upcase} #{pb_date_time.to_day}".html_safe
      end

    private

      def pb_date_time
        Playbook::PbKit::PbDateTime.new(date, timezone)
      end
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
playbook_ui-7.4.0.pre.alpha6 app/pb_kits/playbook/pb_date/date.rb
playbook_ui-7.4.0.pre.alpha4 app/pb_kits/playbook/pb_date/date.rb
playbook_ui-7.4.0.pre.alpha2 app/pb_kits/playbook/pb_date/date.rb
playbook_ui-7.4.0.pre.alpha1 app/pb_kits/playbook/pb_date/date.rb
playbook_ui-7.3.0.pre.alpha12 app/pb_kits/playbook/pb_date/date.rb
playbook_ui-7.3.0.pre.alpha11 app/pb_kits/playbook/pb_date/date.rb
playbook_ui-7.3.0.pre.alpha10 app/pb_kits/playbook/pb_date/date.rb
playbook_ui-7.3.0.pre.alpha9 app/pb_kits/playbook/pb_date/date.rb
playbook_ui-7.3.0.pre.alpha8 app/pb_kits/playbook/pb_date/date.rb
playbook_ui-7.3.0.pre.alpha7 app/pb_kits/playbook/pb_date/date.rb
playbook_ui-7.3.0.pre.alpha6 app/pb_kits/playbook/pb_date/date.rb
playbook_ui-7.3.0.pre.alpha5 app/pb_kits/playbook/pb_date/date.rb
playbook_ui-7.3.0.pre.alpha4 app/pb_kits/playbook/pb_date/date.rb
playbook_ui-7.3.0.pre.alpha3 app/pb_kits/playbook/pb_date/date.rb
playbook_ui-7.3.0.pre.alpha2 app/pb_kits/playbook/pb_date/date.rb
playbook_ui-7.2.0 app/pb_kits/playbook/pb_date/date.rb
playbook_ui-7.1.2 app/pb_kits/playbook/pb_date/date.rb
playbook_ui-7.1.0.pre.alpha2 app/pb_kits/playbook/pb_date/date.rb
playbook_ui-7.1.1.pre.alpha1 app/pb_kits/playbook/pb_date/date.rb
playbook_ui-7.0.1 app/pb_kits/playbook/pb_date/date.rb