Sha256: ba13471b85ca08d6ca2f7d59b5cb1a4c12e64820d0486d7c6fbfdfe8b99ff469

Contents?: true

Size: 755 Bytes

Versions: 1

Compression:

Stored size: 755 Bytes

Contents

# frozen_string_literal: true

module Playbook
  module PbTime
    class Time
      include Playbook::Props

      partial "pb_time/time"

      prop :time, 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_time_kit", size)
      end

      def format_time_string
        "#{pb_date_time.to_hour}:#{pb_date_time.to_minutes}#{pb_date_time.to_meridian}"
      end

      def format_timezone_string
        "#{pb_date_time.to_timezone}"
      end

      def pb_date_time
        pb_date_time ||= Playbook::PbKit::PbDateTime.new(time, timezone)
      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_time/time.rb