diff --git a/portality/static/js/dates.js b/portality/static/js/dates.js
index 8b3715f4a..0216a0da8 100644
--- a/portality/static/js/dates.js
+++ b/portality/static/js/dates.js
@@ -164,6 +164,56 @@ $.extend(true, doaj, {
return new Date(year, month, day, hours, minutes, seconds, milliseconds);
},
+ formatFullDateTime : function(input){
+ try {
+ // Fast validation
+ if (typeof input !== "string" || input.length < 20) {
+ console.error("formatTimestamp: Invalid input →", input);
+ return input;
+ }
+
+ // Normalize microseconds → milliseconds (no regex)
+ let normalized = input;
+ const dotIndex = input.indexOf(".");
+ if (dotIndex !== -1) {
+ const zIndex = input.indexOf("Z", dotIndex);
+ if (zIndex !== -1) {
+ normalized = input.slice(0, dotIndex + 4) + "Z";
+ }
+ }
+
+ const date = new Date(normalized);
+
+ // Invalid date check (fast NaN check)
+ if (date.getTime() !== date.getTime()) {
+ console.error("formatTimestamp: Invalid date →", input);
+ return input;
+ }
+
+ // Extract parts
+ const y = date.getUTCFullYear();
+ const m = date.getUTCMonth() + 1;
+ const d = date.getUTCDate();
+ const h = date.getUTCHours();
+ const min = date.getUTCMinutes();
+ const s = date.getUTCSeconds();
+
+ // Inline formatting (no helper functions)
+ return (
+ y + "-" +
+ (m < 10 ? "0" : "") + m + "-" +
+ (d < 10 ? "0" : "") + d + " " +
+ (h < 10 ? "0" : "") + h + ":" +
+ (min < 10 ? "0" : "") + min + ":" +
+ (s < 10 ? "0" : "") + s
+ );
+
+ } catch (error) {
+ console.error("formatTimestamp: Unexpected error →", error, "Input:", input);
+ return input;
+ }
+ },
+
formatDate: function (date, format) {
const monthNamesShort = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
const monthNamesFull = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
diff --git a/portality/static/js/edges/admin.background_jobs.edge.js b/portality/static/js/edges/admin.background_jobs.edge.js
index ed94d43aa..458359633 100644
--- a/portality/static/js/edges/admin.background_jobs.edge.js
+++ b/portality/static/js/edges/admin.background_jobs.edge.js
@@ -44,10 +44,10 @@ $.extend(true, doaj, {
// add the date added to doaj
if (resultobj.created_date) {
- dateRow += "Job Created: " + doaj.dates.humanYearMonth(resultobj.created_date) + "
";
+ dateRow += "Job Created: " + doaj.dates.formatFullDateTime(resultobj.created_date) + "
";
}
if (resultobj.last_updated) {
- dateRow += "Job Last Updated: " + doaj.dates.humanYearMonth(resultobj.last_updated) + "
";
+ dateRow += "Job Last Updated: " + doaj.dates.formatFullDateTime(resultobj.last_updated) + "
";
}
var paramsBlock = "";