Sha256: d5946c14ff4073c9e1403e82e5fbd05577cfaabe63a3f5c34c4d770430c7fab6

Contents?: true

Size: 967 Bytes

Versions: 1

Compression:

Stored size: 967 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"

      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
        pb_date_time ||= Playbook::PbKit::PbDateTime.new(date)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
playbook_ui-2.9.8 app/pb_kits/playbook/pb_date/date.rb