Sha256: 0b5bfc197289b56f9dc324481e1df20afadda9bd48bfa1242093c198818771c1

Contents?: true

Size: 270 Bytes

Versions: 4

Compression:

Stored size: 270 Bytes

Contents

# frozen_string_literal: true

require 'date'

module Motoko
  module Formatters
    class Datetime < BaseFormatter
      def format(value)
        DateTime.parse(value).to_time.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/datetime.rb
motoko-1.2.0 lib/motoko/formatters/datetime.rb
motoko-1.1.0 lib/motoko/formatters/datetime.rb
motoko-1.0.0 lib/motoko/formatters/datetime.rb