Skip to content

Commit

Permalink
Inversed call to trim()
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Apr 25, 2020
1 parent 2a030cb commit 5bc78c8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions jquery.timeago.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@

var separator = $l.wordSeparator || "";
if ($l.wordSeparator === undefined) { separator = " "; }
return String.prototype.trim.call([prefix, words, suffix].join(separator));
return [prefix, words, suffix].join(separator).trim();
},

parse: function(iso8601) {
var s = String.prototype.trim.call(iso8601);
var s = iso8601.trim();
s = s.replace(/\.\d+/,""); // remove milliseconds
s = s.replace(/-/,"/").replace(/-/,"/");
s = s.replace(/T/," ").replace(/Z/," UTC");
Expand Down Expand Up @@ -208,7 +208,7 @@
element = $(element);
if (!element.data("timeago")) {
element.data("timeago", { datetime: $t.datetime(element) });
var text = String.prototype.trim.call(element.text());
var text = element.text().trim();
if ($t.settings.localeTitle) {
element.attr("title", element.data('timeago').datetime.toLocaleString());
} else if (text.length > 0 && !($t.isTime(element) && element.attr("title"))) {
Expand Down

0 comments on commit 5bc78c8

Please sign in to comment.