const fs = require('fs'); const filePath = '/srv/www/htdocs/comics/index.html'; const strips = require("/srv/www/htdocs/comics/strips.js") function escapeQuotes(value) { return value.replace(/["'&<>]/g, function (char) { switch (char) { case '"': return """; case "'": return "'"; case "&": return "&"; case "<": return "<"; case ">": return ">"; default: return char; } }); } console.log(strips) let linksText = "" let dateObject let month let year let oldMonth = "blibidy blob" let oldYear = "bloopy aw" let counter = 0 for (let page = strips.length - 1; page >= 0; page--) { dateObject = new Date(strips[page][1]) month = dateObject.toLocaleString('en-US', {month: 'long'}); year = dateObject.getFullYear() const dayOfWeek = dateObject.toLocaleString('en-US', { weekday: 'long' }); // 'long' returns the full day name const dayOfMonth = dateObject.getDate(); console.log(month, year, dayOfMonth, dayOfWeek) if (month != oldMonth) { linksText += (`