Module: Jekyll::Timeago::Core
Constant Summary collapse
- MAX_DEPTH_LEVEL =
Max level of detail: years > months > weeks > days
4- DEFAULT_DEPTH_LEVEL =
Default level of detail
2
Instance Method Summary collapse
Instance Method Details
#timeago(from, to = Date.today, options = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/jekyll-timeago/core.rb', line 14 def timeago(from, to = Date.today, = {}) if to.is_a?(Hash) = to to = Date.today end = from = validate_date(from) to = validate_date(to) depth = validate_depth([:depth] || ["depth"]) time_ago_to_now(from, to, depth) end |