Deprectae OC.Util.formatDate and OC.Util.relativeModifiedDate

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: npmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com>
This commit is contained in:
Roeland Jago Douma 2020-05-15 08:42:55 +02:00 committed by npmbuildbot[bot]
parent f80f2a22d7
commit d5a13f8c4a
7 changed files with 8 additions and 6 deletions

View File

@ -126,7 +126,7 @@ function se(e){for(var t,n=[],r=0,i=-1,a=0;r<e.length;){t=e.charAt(r);var o=!a&&
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function(e,t){var n=["B","KB","MB","GB","TB"],r=e>0?Math.floor(Math.log(e)/Math.log(1024)):0,i=n[r=Math.min(n.length-1,r)],a=(e/Math.pow(1024,r)).toFixed(1);return!0===t&&0===r?"0.0"!==a?"< 1 KB":"0 KB":(a=r<2?parseFloat(a).toFixed(0):".0"===a.substr(a.length-2,2)?a.substr(0,a.length-2):parseFloat(a).toLocaleString(OC.getCanonicalLocale()))+" "+i},computerFileSize:function(e){if("string"!=typeof e)return null;var t=e.toLowerCase().trim(),n=null,r=t.match(/^[\s+]?([0-9]*)(\.([0-9]+))?( +)?([kmgtp]?b?)$/i);return null===r?null:(n=parseFloat(t),isFinite(n)?(r[5]&&(n*={b:1,k:1024,kb:1024,mb:1048576,m:1048576,gb:1073741824,g:1073741824,tb:1099511627776,t:1099511627776,pb:0x4000000000000,p:0x4000000000000}[r[5]]),n=Math.round(n)):null)},formatDate:function(e,t){return t=t||"LLL",oe()(e).format(t)},relativeModifiedDate:function(e){var n=oe()().diff(oe()(e));return n>=0&&n<45e3?t("core","seconds ago"):oe()(e).fromNow()},isIE:function(){return s()("html").hasClass("ie")},getScrollBarWidth:function(){if(this._scrollBarWidth)return this._scrollBarWidth;var e=document.createElement("p");e.style.width="100%",e.style.height="200px";var t=document.createElement("div");t.style.position="absolute",t.style.top="0px",t.style.left="0px",t.style.visibility="hidden",t.style.width="200px",t.style.height="150px",t.style.overflow="hidden",t.appendChild(e),document.body.appendChild(t);var n=e.offsetWidth;t.style.overflow="scroll";var r=e.offsetWidth;return n===r&&(r=t.clientWidth),document.body.removeChild(t),this._scrollBarWidth=n-r,this._scrollBarWidth},stripTime:function(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())},naturalSortCompare:function(e,t){var n,r=se(e),i=se(t);for(n=0;r[n]&&i[n];n++)if(r[n]!==i[n]){var a=Number(r[n]),o=Number(i[n]);return a==r[n]&&o==i[n]?a-o:r[n].localeCompare(i[n],pe.getLanguage())}return r.length-i.length},waitFor:function(e,t){!function n(){!0!==e()&&setTimeout(n,t)}()},isCookieSetToValue:function(e,t){for(var n=document.cookie.split(";"),r=0;r<n.length;r++){var i=n[r].split("=");if(i[0].trim()===e&&i[1].trim()===t)return!0}return!1}},ce=window._oc_debug,le=window._oc_webroot;
function(e,t){var n=["B","KB","MB","GB","TB"],r=e>0?Math.floor(Math.log(e)/Math.log(1024)):0,i=n[r=Math.min(n.length-1,r)],a=(e/Math.pow(1024,r)).toFixed(1);return!0===t&&0===r?"0.0"!==a?"< 1 KB":"0 KB":(a=r<2?parseFloat(a).toFixed(0):".0"===a.substr(a.length-2,2)?a.substr(0,a.length-2):parseFloat(a).toLocaleString(OC.getCanonicalLocale()))+" "+i},computerFileSize:function(e){if("string"!=typeof e)return null;var t=e.toLowerCase().trim(),n=null,r=t.match(/^[\s+]?([0-9]*)(\.([0-9]+))?( +)?([kmgtp]?b?)$/i);return null===r?null:(n=parseFloat(t),isFinite(n)?(r[5]&&(n*={b:1,k:1024,kb:1024,mb:1048576,m:1048576,gb:1073741824,g:1073741824,tb:1099511627776,t:1099511627776,pb:0x4000000000000,p:0x4000000000000}[r[5]]),n=Math.round(n)):null)},formatDate:function(e,t){return console.warn("OC.Util.formatDate is deprecated and will be removed in Nextcloud 21. See @nextcloud/moment"),t=t||"LLL",oe()(e).format(t)},relativeModifiedDate:function(e){console.warn("OC.Util.relativeModifiedDate is deprecated and will be removed in Nextcloud 21. See @nextcloud/moment");var n=oe()().diff(oe()(e));return n>=0&&n<45e3?t("core","seconds ago"):oe()(e).fromNow()},isIE:function(){return s()("html").hasClass("ie")},getScrollBarWidth:function(){if(this._scrollBarWidth)return this._scrollBarWidth;var e=document.createElement("p");e.style.width="100%",e.style.height="200px";var t=document.createElement("div");t.style.position="absolute",t.style.top="0px",t.style.left="0px",t.style.visibility="hidden",t.style.width="200px",t.style.height="150px",t.style.overflow="hidden",t.appendChild(e),document.body.appendChild(t);var n=e.offsetWidth;t.style.overflow="scroll";var r=e.offsetWidth;return n===r&&(r=t.clientWidth),document.body.removeChild(t),this._scrollBarWidth=n-r,this._scrollBarWidth},stripTime:function(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())},naturalSortCompare:function(e,t){var n,r=se(e),i=se(t);for(n=0;r[n]&&i[n];n++)if(r[n]!==i[n]){var a=Number(r[n]),o=Number(i[n]);return a==r[n]&&o==i[n]?a-o:r[n].localeCompare(i[n],pe.getLanguage())}return r.length-i.length},waitFor:function(e,t){!function n(){!0!==e()&&setTimeout(n,t)}()},isCookieSetToValue:function(e,t){for(var n=document.cookie.split(";"),r=0;r<n.length;r++){var i=n[r].split("=");if(i[0].trim()===e&&i[1].trim()===t)return!0}return!1}},ce=window._oc_debug,le=window._oc_webroot;
/*
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
*

File diff suppressed because one or more lines are too long

View File

@ -126,7 +126,7 @@ function ae(e){for(var t,n=[],i=0,r=-1,o=0;i<e.length;){t=e.charAt(i);var s=!o&&
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function(e,t){var n=["B","KB","MB","GB","TB"],i=e>0?Math.floor(Math.log(e)/Math.log(1024)):0,r=n[i=Math.min(n.length-1,i)],o=(e/Math.pow(1024,i)).toFixed(1);return!0===t&&0===i?"0.0"!==o?"< 1 KB":"0 KB":(o=i<2?parseFloat(o).toFixed(0):".0"===o.substr(o.length-2,2)?o.substr(0,o.length-2):parseFloat(o).toLocaleString(OC.getCanonicalLocale()))+" "+r},computerFileSize:function(e){if("string"!=typeof e)return null;var t=e.toLowerCase().trim(),n=null,i=t.match(/^[\s+]?([0-9]*)(\.([0-9]+))?( +)?([kmgtp]?b?)$/i);return null===i?null:(n=parseFloat(t),isFinite(n)?(i[5]&&(n*={b:1,k:1024,kb:1024,mb:1048576,m:1048576,gb:1073741824,g:1073741824,tb:1099511627776,t:1099511627776,pb:0x4000000000000,p:0x4000000000000}[i[5]]),n=Math.round(n)):null)},formatDate:function(e,t){return t=t||"LLL",se()(e).format(t)},relativeModifiedDate:function(e){var n=se()().diff(se()(e));return n>=0&&n<45e3?t("core","seconds ago"):se()(e).fromNow()},isIE:function(){return a()("html").hasClass("ie")},getScrollBarWidth:function(){if(this._scrollBarWidth)return this._scrollBarWidth;var e=document.createElement("p");e.style.width="100%",e.style.height="200px";var t=document.createElement("div");t.style.position="absolute",t.style.top="0px",t.style.left="0px",t.style.visibility="hidden",t.style.width="200px",t.style.height="150px",t.style.overflow="hidden",t.appendChild(e),document.body.appendChild(t);var n=e.offsetWidth;t.style.overflow="scroll";var i=e.offsetWidth;return n===i&&(i=t.clientWidth),document.body.removeChild(t),this._scrollBarWidth=n-i,this._scrollBarWidth},stripTime:function(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())},naturalSortCompare:function(e,t){var n,i=ae(e),r=ae(t);for(n=0;i[n]&&r[n];n++)if(i[n]!==r[n]){var o=Number(i[n]),s=Number(r[n]);return o==i[n]&&s==r[n]?o-s:i[n].localeCompare(r[n],pe.getLanguage())}return i.length-r.length},waitFor:function(e,t){!function n(){!0!==e()&&setTimeout(n,t)}()},isCookieSetToValue:function(e,t){for(var n=document.cookie.split(";"),i=0;i<n.length;i++){var r=n[i].split("=");if(r[0].trim()===e&&r[1].trim()===t)return!0}return!1}},ue=window._oc_debug,ce=window._oc_webroot;
function(e,t){var n=["B","KB","MB","GB","TB"],i=e>0?Math.floor(Math.log(e)/Math.log(1024)):0,r=n[i=Math.min(n.length-1,i)],o=(e/Math.pow(1024,i)).toFixed(1);return!0===t&&0===i?"0.0"!==o?"< 1 KB":"0 KB":(o=i<2?parseFloat(o).toFixed(0):".0"===o.substr(o.length-2,2)?o.substr(0,o.length-2):parseFloat(o).toLocaleString(OC.getCanonicalLocale()))+" "+r},computerFileSize:function(e){if("string"!=typeof e)return null;var t=e.toLowerCase().trim(),n=null,i=t.match(/^[\s+]?([0-9]*)(\.([0-9]+))?( +)?([kmgtp]?b?)$/i);return null===i?null:(n=parseFloat(t),isFinite(n)?(i[5]&&(n*={b:1,k:1024,kb:1024,mb:1048576,m:1048576,gb:1073741824,g:1073741824,tb:1099511627776,t:1099511627776,pb:0x4000000000000,p:0x4000000000000}[i[5]]),n=Math.round(n)):null)},formatDate:function(e,t){return console.warn("OC.Util.formatDate is deprecated and will be removed in Nextcloud 21. See @nextcloud/moment"),t=t||"LLL",se()(e).format(t)},relativeModifiedDate:function(e){console.warn("OC.Util.relativeModifiedDate is deprecated and will be removed in Nextcloud 21. See @nextcloud/moment");var n=se()().diff(se()(e));return n>=0&&n<45e3?t("core","seconds ago"):se()(e).fromNow()},isIE:function(){return a()("html").hasClass("ie")},getScrollBarWidth:function(){if(this._scrollBarWidth)return this._scrollBarWidth;var e=document.createElement("p");e.style.width="100%",e.style.height="200px";var t=document.createElement("div");t.style.position="absolute",t.style.top="0px",t.style.left="0px",t.style.visibility="hidden",t.style.width="200px",t.style.height="150px",t.style.overflow="hidden",t.appendChild(e),document.body.appendChild(t);var n=e.offsetWidth;t.style.overflow="scroll";var i=e.offsetWidth;return n===i&&(i=t.clientWidth),document.body.removeChild(t),this._scrollBarWidth=n-i,this._scrollBarWidth},stripTime:function(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())},naturalSortCompare:function(e,t){var n,i=ae(e),r=ae(t);for(n=0;i[n]&&r[n];n++)if(i[n]!==r[n]){var o=Number(i[n]),s=Number(r[n]);return o==i[n]&&s==r[n]?o-s:i[n].localeCompare(r[n],pe.getLanguage())}return i.length-r.length},waitFor:function(e,t){!function n(){!0!==e()&&setTimeout(n,t)}()},isCookieSetToValue:function(e,t){for(var n=document.cookie.split(";"),i=0;i<n.length;i++){var r=n[i].split("=");if(r[0].trim()===e&&r[1].trim()===t)return!0}return!1}},ue=window._oc_debug,ce=window._oc_webroot;
/*
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
*

File diff suppressed because one or more lines are too long

View File

@ -126,7 +126,7 @@ function se(e){for(var t,n=[],r=0,i=-1,a=0;r<e.length;){t=e.charAt(r);var o=!a&&
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function(e,t){var n=["B","KB","MB","GB","TB"],r=e>0?Math.floor(Math.log(e)/Math.log(1024)):0,i=n[r=Math.min(n.length-1,r)],a=(e/Math.pow(1024,r)).toFixed(1);return!0===t&&0===r?"0.0"!==a?"< 1 KB":"0 KB":(a=r<2?parseFloat(a).toFixed(0):".0"===a.substr(a.length-2,2)?a.substr(0,a.length-2):parseFloat(a).toLocaleString(OC.getCanonicalLocale()))+" "+i},computerFileSize:function(e){if("string"!=typeof e)return null;var t=e.toLowerCase().trim(),n=null,r=t.match(/^[\s+]?([0-9]*)(\.([0-9]+))?( +)?([kmgtp]?b?)$/i);return null===r?null:(n=parseFloat(t),isFinite(n)?(r[5]&&(n*={b:1,k:1024,kb:1024,mb:1048576,m:1048576,gb:1073741824,g:1073741824,tb:1099511627776,t:1099511627776,pb:0x4000000000000,p:0x4000000000000}[r[5]]),n=Math.round(n)):null)},formatDate:function(e,t){return t=t||"LLL",oe()(e).format(t)},relativeModifiedDate:function(e){var n=oe()().diff(oe()(e));return n>=0&&n<45e3?t("core","seconds ago"):oe()(e).fromNow()},isIE:function(){return s()("html").hasClass("ie")},getScrollBarWidth:function(){if(this._scrollBarWidth)return this._scrollBarWidth;var e=document.createElement("p");e.style.width="100%",e.style.height="200px";var t=document.createElement("div");t.style.position="absolute",t.style.top="0px",t.style.left="0px",t.style.visibility="hidden",t.style.width="200px",t.style.height="150px",t.style.overflow="hidden",t.appendChild(e),document.body.appendChild(t);var n=e.offsetWidth;t.style.overflow="scroll";var r=e.offsetWidth;return n===r&&(r=t.clientWidth),document.body.removeChild(t),this._scrollBarWidth=n-r,this._scrollBarWidth},stripTime:function(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())},naturalSortCompare:function(e,t){var n,r=se(e),i=se(t);for(n=0;r[n]&&i[n];n++)if(r[n]!==i[n]){var a=Number(r[n]),o=Number(i[n]);return a==r[n]&&o==i[n]?a-o:r[n].localeCompare(i[n],me.getLanguage())}return r.length-i.length},waitFor:function(e,t){!function n(){!0!==e()&&setTimeout(n,t)}()},isCookieSetToValue:function(e,t){for(var n=document.cookie.split(";"),r=0;r<n.length;r++){var i=n[r].split("=");if(i[0].trim()===e&&i[1].trim()===t)return!0}return!1}},le=window._oc_debug,de=window._oc_webroot;
function(e,t){var n=["B","KB","MB","GB","TB"],r=e>0?Math.floor(Math.log(e)/Math.log(1024)):0,i=n[r=Math.min(n.length-1,r)],a=(e/Math.pow(1024,r)).toFixed(1);return!0===t&&0===r?"0.0"!==a?"< 1 KB":"0 KB":(a=r<2?parseFloat(a).toFixed(0):".0"===a.substr(a.length-2,2)?a.substr(0,a.length-2):parseFloat(a).toLocaleString(OC.getCanonicalLocale()))+" "+i},computerFileSize:function(e){if("string"!=typeof e)return null;var t=e.toLowerCase().trim(),n=null,r=t.match(/^[\s+]?([0-9]*)(\.([0-9]+))?( +)?([kmgtp]?b?)$/i);return null===r?null:(n=parseFloat(t),isFinite(n)?(r[5]&&(n*={b:1,k:1024,kb:1024,mb:1048576,m:1048576,gb:1073741824,g:1073741824,tb:1099511627776,t:1099511627776,pb:0x4000000000000,p:0x4000000000000}[r[5]]),n=Math.round(n)):null)},formatDate:function(e,t){return console.warn("OC.Util.formatDate is deprecated and will be removed in Nextcloud 21. See @nextcloud/moment"),t=t||"LLL",oe()(e).format(t)},relativeModifiedDate:function(e){console.warn("OC.Util.relativeModifiedDate is deprecated and will be removed in Nextcloud 21. See @nextcloud/moment");var n=oe()().diff(oe()(e));return n>=0&&n<45e3?t("core","seconds ago"):oe()(e).fromNow()},isIE:function(){return s()("html").hasClass("ie")},getScrollBarWidth:function(){if(this._scrollBarWidth)return this._scrollBarWidth;var e=document.createElement("p");e.style.width="100%",e.style.height="200px";var t=document.createElement("div");t.style.position="absolute",t.style.top="0px",t.style.left="0px",t.style.visibility="hidden",t.style.width="200px",t.style.height="150px",t.style.overflow="hidden",t.appendChild(e),document.body.appendChild(t);var n=e.offsetWidth;t.style.overflow="scroll";var r=e.offsetWidth;return n===r&&(r=t.clientWidth),document.body.removeChild(t),this._scrollBarWidth=n-r,this._scrollBarWidth},stripTime:function(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())},naturalSortCompare:function(e,t){var n,r=se(e),i=se(t);for(n=0;r[n]&&i[n];n++)if(r[n]!==i[n]){var a=Number(r[n]),o=Number(i[n]);return a==r[n]&&o==i[n]?a-o:r[n].localeCompare(i[n],me.getLanguage())}return r.length-i.length},waitFor:function(e,t){!function n(){!0!==e()&&setTimeout(n,t)}()},isCookieSetToValue:function(e,t){for(var n=document.cookie.split(";"),r=0;r<n.length;r++){var i=n[r].split("=");if(i[0].trim()===e&&i[1].trim()===t)return!0}return!1}},le=window._oc_debug,de=window._oc_webroot;
/*
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
*

File diff suppressed because one or more lines are too long

View File

@ -114,6 +114,7 @@ export default {
* @returns {string} timestamp formatted as requested
*/
formatDate: function(timestamp, format) {
console.warn('OC.Util.formatDate is deprecated and will be removed in Nextcloud 21. See @nextcloud/moment')
format = format || 'LLL'
return moment(timestamp).format(format)
},
@ -123,6 +124,7 @@ export default {
* @returns {string} human readable difference from now
*/
relativeModifiedDate: function(timestamp) {
console.warn('OC.Util.relativeModifiedDate is deprecated and will be removed in Nextcloud 21. See @nextcloud/moment')
const diff = moment().diff(moment(timestamp))
if (diff >= 0 && diff < 45000) {
return t('core', 'seconds ago')