Browse Source

Update abp.js

pull/22226/head
maliming 1 year ago
parent
commit
ec2e78aa05
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 41
      npm/packs/core/src/abp.js

41
npm/packs/core/src/abp.js

@ -797,25 +797,44 @@ var abp = abp || {};
if (kind === 'Utc') { if (kind === 'Utc') {
return toUtc(date); return toUtc(date);
} }
return date;
}; };
abp.clock.normalizeString = function (dateString) { abp.clock.normalizeString = function (dateString) {
var date = abp.clock.normalize(new Date(dateString)); if (!dateString) {
return dateString;
var kind = abp.clock.kind; }
if(kind === 'Local' || kind === 'Unspecified'){ var date = new Date(dateString);
return date.getFullYear() + "-" + if (isNaN(date)) {
String(date.getMonth() + 1).padStart(2, "0") + "-" + return dateString;
String(date.getDate()).padStart(2, "0") + "T" +
String(date.getHours()).padStart(2, "0") + ":" +
String(date.getMinutes()).padStart(2, "0") + ":" +
String(date.getSeconds()).padStart(2, "0") + ".000";
} }
if(kind === 'Utc'){ date = abp.clock.normalize(date);
if(abp.clock.kind === 'Utc'){
return date.toISOString(); return date.toISOString();
} }
function padZero(num) {
return num < 10 ? '0' + num : num;
}
function padMilliseconds(num) {
if (num < 10) return '00' + num;
if (num < 100) return '0' + num;
return num;
}
// yyyy-MM-ddTHH:mm:ss.SSS
return date.getFullYear() + '-' +
padZero(date.getMonth() + 1) + '-' +
padZero(date.getDate()) + 'T' +
padZero(date.getHours()) + ':' +
padZero(date.getMinutes()) + ':' +
padZero(date.getSeconds()) + '.' +
padMilliseconds(date.getMilliseconds());
} }
/* FEATURES *************************************************/ /* FEATURES *************************************************/

Loading…
Cancel
Save