Class: Motoko::Formatters::DatetimeAgo
- Inherits:
-
BaseFormatter
- Object
- BaseFormatter
- Motoko::Formatters::DatetimeAgo
- Includes:
- Utils::TimeAgo
- Defined in:
- lib/motoko/formatters/datetime_ago.rb
Instance Method Summary collapse
Methods included from Utils::TimeAgo
Methods inherited from BaseFormatter
Constructor Details
This class inherits a constructor from Motoko::Formatters::BaseFormatter
Instance Method Details
#format(value) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/motoko/formatters/datetime_ago.rb', line 12 def format(value) return nil unless value seconds_to_human(Time.now - DateTime.parse(value).to_time) rescue ArgumentError nil end |