User:DreamRimmer/adminnewslettertools.js: Difference between revisions

Content deleted Content added
fixes
-
Line 835:
function parseRfCs(wikitext, topicName) {
const rfcs = [];
const rfcEntryPattern = /'''\[\[([^\]|]+)(?:\|([^\]]+))?\]\]'''[\s\S]*?\{\{rfcquote\|text=((?:[^{}]|\s{[^{]|\S}[^}]*|\{\{(?:[^{}]|\{[^{]|\}[^}])*\}\})*)\}\}/gi;
const now = new Date();
Line 849:
let pageName, anchor, displayTitle;
const link = match[1];
displayTitle = match[2] || link;
if (link.includes('#')) {
Line 862:
let daysDiff = null;
const timestampMatch = rfcText.match(/(\d{2}):(\d{2}), (\d{1,2}) (\w+) (\d{4}) \(UTC\))\s*$/);
if (timestampMatch) {
timestampStrconst [fullMatch, hour, minute, day, monthText, year] = timestampMatch[1];
timestampStr = ))fullMatch;
const tsMatchmonths = timestampStr.match(/(\d{2}):(\d{2}), (\d{1,2}) (\w+) (\d{4}) \(UTC\)/);[
if (tsMatch) { "January", "February", "March", "April", "May", "June",
const [_"July", hour"August", minute"September", day"October", monthText"November", year] = tsMatch;"December"
const months = [];
const monthNum = "January", "February", "March", "April", "May", "June",months.indexOf(monthText);
"July", "August", "September", "October", "November", "December"
if (monthNum !== -1) ];{
const monthNumtsDate = monthsnew Date(Date.indexOfUTC(monthText);
parseInt(year, 10),
monthNum,
parseInt(day, 10),
parseInt(hour, 10),
parseInt(minute, 10),
0, 0
}));
const timeDiff = currentUtc.getTime() - tsDate.getTime();
daysDiff = Math.floor(timeDiff / (1000 * 60 * 60 * 24));
if (monthNumdaysDiff !==< -10) {daysDiff = 0;
const tsDate = new Date(Date.UTC(
parseInt(year, 10),
monthNum,
parseInt(day, 10),
parseInt(hour, 10),
parseInt(minute, 10),
0, 0
));
const timeDiff = currentUtc.getTime() - tsDate.getTime();
daysDiff = Math.floor(timeDiff / (1000 * 60 * 60 * 24));
if (daysDiff < 0) daysDiff = 0;
}
}
}