Sha256: ed36f4fa6f20b3690f35fa601a6c75a0b7e93adff6e9c8ecd08b8aea5e384e5d

Contents?: true

Size: 567 Bytes

Versions: 2

Compression:

Stored size: 567 Bytes

Contents

# frozen_string_literal: true

require 'timezone'

module BrInvoicesPdf
  module Nfce
    module Renderer
      module BaseRenderer
        extend Util::BaseRenderer

        module_function

        ADDRESS_FORMAT = '%s, %s, %s, %s/%s'
        def format_address(address)
          ADDRESS_FORMAT % %i(streetname number district city state).map(&address.method(:[]))
        end

        def format_date(date)
          Timezone[ENV['INVOICE_TIMEZONE'] || 'America/Sao_Paulo'].utc_to_local(date).strftime('%H:%M:%S %d/%m/%Y')
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
br_invoices_pdf-0.2.24 lib/br_invoices_pdf/nfce/renderer/base_renderer.rb
br_invoices_pdf-0.2.23 lib/br_invoices_pdf/nfce/renderer/base_renderer.rb