From 75c384d419a6c9176954c367fb826de292328fac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corentin=20No=C3=ABl?= Date: Tue, 17 Nov 2020 20:17:17 +0100 Subject: [PATCH] Replace depredated OC.Util.*Date function with moment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As per https://github.com/nextcloud/server/pull/20988 Signed-off-by: Corentin Noël --- js/activitymodel.js | 2 +- src/legacy_scripts/activitymodel.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/js/activitymodel.js b/js/activitymodel.js index 45dd7f772..cb8420879 100644 --- a/js/activitymodel.js +++ b/js/activitymodel.js @@ -1 +1 @@ -!function(){var t=OC.Backbone.Model.extend({getUnixMilliseconds:function(){return _.isUndefined(this.unixMilliseconds)&&(this.unixMilliseconds=moment(this.get("datetime")).valueOf()),this.unixMilliseconds},getRelativeDate:function(){return OC.Util.relativeModifiedDate(this.getUnixMilliseconds())},getFullDate:function(){return OC.Util.formatDate(this.getUnixMilliseconds())},isMonochromeIcon:function(){return"file_created"!==this.get("type")&&"file_deleted"!==this.get("type")&&"favorite"!==this.get("type")}});OCA.Activity=OCA.Activity||{},OCA.Activity.ActivityModel=t}(); \ No newline at end of file +!function(){var t=OC.Backbone.Model.extend({getUnixMilliseconds:function(){return _.isUndefined(this.unixMilliseconds)&&(this.unixMilliseconds=moment(this.get("datetime")).valueOf()),this.unixMilliseconds},getRelativeDate:function(){return moment(this.getUnixMilliseconds()).fromNow()},getFullDate:function(){return moment(this.getUnixMilliseconds()).format("LLL")},isMonochromeIcon:function(){return"file_created"!==this.get("type")&&"file_deleted"!==this.get("type")&&"favorite"!==this.get("type")}});OCA.Activity=OCA.Activity||{},OCA.Activity.ActivityModel=t}(); \ No newline at end of file diff --git a/src/legacy_scripts/activitymodel.js b/src/legacy_scripts/activitymodel.js index d33238492..ebec1ac46 100644 --- a/src/legacy_scripts/activitymodel.js +++ b/src/legacy_scripts/activitymodel.js @@ -32,14 +32,14 @@ * @returns string E.g. "seconds ago" */ getRelativeDate: function () { - return OC.Util.relativeModifiedDate(this.getUnixMilliseconds()); + return moment(this.getUnixMilliseconds()).fromNow(); }, /** * @returns string E.g. "April 26, 2016 10:53 AM" */ getFullDate: function () { - return OC.Util.formatDate(this.getUnixMilliseconds()); + return moment(this.getUnixMilliseconds()).format('LLL'); }, /**