User:DreamRimmer/adminnewslettertools.js: Difference between revisions

Content deleted Content added
fixes
fix date parser
Tag: Reverted
Line 574:
if (timestampMatch) {
const timestampStr = timestampMatch[1];
const rfcDatecleanTimestamp = new Date(timestampStr.replace(' (UTC)', ' UTC').replace(/(\d{1,2}) (\w+) (\d{4})/, '$2 $1, $3');
const rfcDate = new Date(cleanTimestamp + ' UTC');
const now = new Date();
const daysDiff = Math.floor((now - rfcDate) / (1000 * 60 * 60 * 24));
Line 622 ⟶ 623:
html += `</select></p>`;
 
ifconst (rfcs.lengthdefaultAge >= 0) {7;
const defaultFilteredRfcs = rfcs.filter(rfc => rfc.daysOld <= defaultAge);
html += '<h4>All Current RfCs</h4><table class="wikitable sortable"><thead><tr><th>Topic</th><th>Title</th><th>Days Old</th><th>Started</th></tr></thead><tbody>';
rfcs.sort((a, b) => a.daysOld - b.daysOld).forEach(rfc => {
if (defaultFilteredRfcs.length > 0) {
html += '`<h4>All Current RfCs (${defaultAge} days or newer)</h4><table class="wikitable sortable"><thead><tr><th>Topic</th><th>Title</th><th>Days Old</th><th>Started</th></tr></thead><tbody>'`;
rfcsdefaultFilteredRfcs.sort((a, b) => a.daysOld - b.daysOld).forEach(rfc => {
html += `<tr><td>${rfc.topic}</td><td><a href="${rfc.url}" target="_blank">${rfc.title}</a></td><td>${rfc.daysOld}</td><td>${rfc.timestamp}</td></tr>`;
});
html += '</tbody></table>';
} else {
html += `<p>No RfCs found that are ${defaultAge} days old or newer.</p>`;
}
 
Line 639 ⟶ 645:
html += `<tr><td>${topic}</td>`;
ageOptions.forEach(age => {
const count = rfcs.filter(rfc => rfc.topic === topic && !isNaN(rfc.daysOld) && rfc.daysOld <= age).length;
html += `<td>${count}</td>`;
});
Line 647 ⟶ 653:
 
ageOptions.forEach(age => {
const filteredRfcs = rfcs.filter(rfc => !isNaN(rfc.daysOld) && rfc.daysOld <= age);
const displayStyle = age === 7 ? 'block' : 'none';
html += `<div class="rfc-age-group" data-age="${age}" style="display: ${displayStyle};">`;
html += `<h4>RfCs ${age} days old or newer (${filteredRfcs.length} total)</h4>`;
if (filteredRfcs.length === 0) {