Skip to content

Commit a9b20c6

Browse files
committed
try a new function
1 parent 79361fa commit a9b20c6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

webroot/js/participantSummary.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,16 @@ function loadSiteCallback(result) {
7777
$('#siteStandardOutput').html(formatted);
7878
}
7979

80+
function formatUnixDate(unixTime) {
81+
const time = unixTime < 1e12 ? unixTime * 1000 : unixTime;
82+
return new Date(time).toLocaleString();
83+
}
84+
8085
function loadAPIKeysCallback(result) {
81-
console.log('bare result function received', result);
8286
const textToHighlight = '"disabled": true';
8387
let resultJson = JSON.parse(result);
8488
resultJson = resultJson.map((item) => {
85-
console.log(`Raw created value: ${item.created}`); // Before formatting
86-
const created = new Date(item.created * 1000).toLocaleString();
87-
console.log(`Formatted created time: ${created}`); // After formatting
89+
const created = new Date(formatUnixDate(item.created)).toLocaleString();
8890
return { ...item, created };
8991
});
9092
const formatted = prettifyJson(JSON.stringify(resultJson));

0 commit comments

Comments
 (0)