var range; function add(html, id) { const old = document.getElementById(id) if (old !== null) { old.remove() } if (range === undefined) { var range = document.createRange() range.setStart(document.body, 0) } document.body.appendChild( range.createContextualFragment(html) ) } function remove(id) { const old = document.getElementById(id) if (old !== null) { old.remove() } } const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; const letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']; function parseMonth(month) { if (month > -1 && month < 26) { return months[month] } else { let first = letters[month%26].toUpperCase() let middle = letters[month*13%26] let last = letters[month*50%26] return first + middle + last } } function parseDate(date) { return parseMonth(date.getUTCMonth()) + ' ' + date.getUTCDate() + ', ' + date.getUTCFullYear() + ' ' + date.toLocaleTimeString(); }