markets / jekyll-timeago

โŒ› Ruby library to compute distance of dates in words. Originally built for Jekyll.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'Today' not working

davegreenwp opened this issue ยท comments

Hello!

I'm using this in a standard site.posts for loop:

{{ post.date | timeago }}

I have a test post that is dated today, yet instead of displaying 'today' I'm just getting 'day'.

Any ideas? My config is as follows:

jekyll_timeago:
depth: 2
today: 'today'
yesterday: 'yesterday'
tomorrow: 'tomorrow'
and: 'and'
suffix: 'ago'
prefix: ''
suffix_future: 'in'
prefix_future: ''
years: 'years'
year: 'year'
months: 'months'
month: 'month'
weeks: 'weeks'
week: 'week'
days: 'days'
day: 'day'

Cheers,
Dave

hey @davetgreen,

It works for me with no problems, tests are also passing. So, could be the YAML format? Note the identation after the jekyll_timeago: namespace:

jekyll_timeago:
  depth: 2
  today: 'today'
  yesterday: 'yesterday'

Btw, I see you are using the default configuration, so you don't really need to add it to your config.yml.

Let me know any changes. Thanks!

Hey @markets. The indentation was lost when I pasted it in: it's exactly as it should be. I'll try removing it from the _config.yml and rebuilding when I get home tonight. Will let you know, cheers!

No change even with the default config options removed from the _config.yml. Any suggestions?

It's not easy without the source code, but would be interesting to know:

  • jekyll and jekyll-timeago versions
  • jekyll-timeago installation (jekyll native way, bundler, manual)
  • date of post (post.date)

Is the repo public? If not, would be amazing a jekyll sample app (blank jekyll app) reproducing the error.

Jekyll 2.4.0 and and timeago 0.8.0: both gems manually installed on OSX. The post date in the front matter is: 2014-10-06 20:48:00.

I realised I'd not fully rebuilt everything before, so I just tried again. Seeing some odd behaviour.

With the full default config pasted into the config file, the issue is reproduced. Taking just the 'day' config parameter out whilst still leaving the rest of the config intact resolves it. For some reason having the day parameter present causes the problem.

Whilst the source isn't in a repo yet, it's just a basic portfolio/blog website I'm building so really nothing fancy at all.

hey @davetgreen, fixed! default (fallback if no config) options were wrong for today.

Fixed and released version 0.8.2 (https://github.com/markets/jekyll-timeago/releases/tag/v0.8.2) :shipit:

Thanks a lot for your help! ๐Ÿ‘

Brilliant, glad I could help! And thank you for such a useful plugin! :)

You're welcome ๐Ÿ‘ Sharing and stars are really appreciated ๐Ÿ˜ƒ