Sha256: b237e416dac0727b4987b30c04ca7b2cd7a66eb0dd04a4ce6b7ff5df14fb32be

Contents?: true

Size: 265 Bytes

Versions: 4

Compression:

Stored size: 265 Bytes

Contents

# frozen_string_literal: true

require 'date'

module Motoko
  module Formatters
    class Timestamp < BaseFormatter
      def format(value)
        Time.at(Integer(value)).getlocal.to_s
      rescue ArgumentError, TypeError
        nil
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
motoko-1.2.1 lib/motoko/formatters/timestamp.rb
motoko-1.2.0 lib/motoko/formatters/timestamp.rb
motoko-1.1.0 lib/motoko/formatters/timestamp.rb
motoko-1.0.0 lib/motoko/formatters/timestamp.rb