Settings defaults and changing suffix is wrong #20

mzahidriaz opened this Issue Mar 23, 2013 · 0 comments


None yet
1 participant


Ways mentioned in the documentation/website are wrong to set default options. Because if you do this

$.fn.timeago.defaults = {
selector: 'time.timeago',
attr: 'datetime',
dir: 'up',
suffix: 'ago'

this will replace whole default options written in the pluggin.js file.
You have to manually change single item like

$.fn.timeago.defaults.selector = 'abbr.timeago';
$.fn.timeago.defaults.attr = 'title';

This will do the trick.


If you change the direction to down and suffix to "from now" like mentioned on the website. This doesn't change any suffix at all. Becuase in plugin js file you are getting the suffix information from the "options.lang.suffix"

To fix this either pass the suffix like

dir: 'down',
lang : {
suffix: 'from now'

but this will cause another problem because the extend you use in plugin is not recursive. You also have to change this and pass true as first argument.

TimeAgo.prototype.init = function(element, options) {
this.$element = $(element);
this.options = $.extend(true, {}, $.fn.timeago.defaults, options);
return this.startTimer();

Or you can change the plugin to change the location of suffix. Instead of taking this from lang you can place it outside lang.

Or you can add a separate prefix for future tense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment