From 7d629115d99630da2664ee58d2a8019eb5509800 Mon Sep 17 00:00:00 2001 From: yossizahn Date: Sun, 29 Dec 2019 08:56:26 +0000 Subject: [PATCH] Fix issue #32 Be more forgiving toward Date objects provided via Angularjs interpolation. See comments on Issue #32 --- src/time-ago.factory.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/time-ago.factory.js b/src/time-ago.factory.js index 571da25..a3d4f59 100644 --- a/src/time-ago.factory.js +++ b/src/time-ago.factory.js @@ -94,6 +94,7 @@ angular.module('yaru22.angular-timeago').factory('timeAgo', function($filter, ti s = s.replace(/-/, '/').replace(/-/, '/'); s = s.replace(/T/, ' ').replace(/Z/, ' UTC'); s = s.replace(/([\+\-]\d\d)\:?(\d\d)/, ' $1$2'); // -04:00 -> -0400 + s = s.replace(/^"(.*)"$/, '$1'); return new Date(s); } };