Class: Motoko::Formatters::Datetime

Inherits:
BaseFormatter show all
Defined in:
lib/motoko/formatters/datetime.rb

Instance Method Summary collapse

Methods inherited from BaseFormatter

#initialize

Constructor Details

This class inherits a constructor from Motoko::Formatters::BaseFormatter

Instance Method Details

#format(value) ⇒ Object



8
9
10
11
12
# File 'lib/motoko/formatters/datetime.rb', line 8

def format(value)
  DateTime.parse(value).to_time.getlocal.to_s
rescue ArgumentError, TypeError
  nil
end