_ _    _ _____  ___   __                       
 __      _(_) | _(_)___ / ( _ ) / /_   ___ ___  _ __ ___  
 \ \ /\ / / | |/ / | |_ \ / _ \| '_ \ / __/ _ \| '_ ` _ \ 
  \ V  V /| |   <| |___) | (_) | (_) | (_| (_) | | | | | |
   \_/\_/ |_|_|\_\_|____/ \___/ \___(_)___\___/|_| |_| |_|

User:Blue-Haired Lawyer/localise dates.js

In this article we want to address the topic of User:Blue-Haired Lawyer/localise dates.js, which has been the subject of numerous studies, debates and controversies throughout history. User:Blue-Haired Lawyer/localise dates.js has had a significant impact in various areas, from politics to the economy, to society in general. The relevance of User:Blue-Haired Lawyer/localise dates.js has been such that it has aroused the interest of academics, experts and researchers, who have dedicated numerous efforts to trying to understand its influence and scope. Throughout these pages, we will explore the different facets of User:Blue-Haired Lawyer/localise dates.js, analyzing its origins, its evolution over time and its impact today. We hope that this article can contribute to shedding light on a topic as complex and significant as User:Blue-Haired Lawyer/localise dates.js.
function replaceDates(ignore, time, day, month, year) {
	var then = new Date(month + " " + day + ", " + year + " " + time + ":" + "00 UTC");
	
	var diff = getDaysSince1970(now) - getDaysSince1970(then);

	var lhour = then.getHours();
	var merdian = 'am';

	if(lhour > 11) merdian = 'pm';
	if(lhour == 0) lhour = 12;
	if(lhour > 12) lhour -= 12;

	var ltime = lhour + ":" + pad(then.getMinutes()) + " " + merdian; // local

	if(diff == 0) {
		return "Today, " + ltime;
	} else if(diff == 1) {
		return "Yesterday, " + ltime;
	} else if(diff > 1 && diff < 7) {
		return days + ", " + ltime;
	} else {
		return ltime + ", " +  then.getDate() + " " + months + " " + (then.getYear() + 1900);
	}
}

function getDaysSince1970(date_obj) {
	var msecs = date_obj.valueOf(); // in UTC
	msecs -= date_obj.getTimezoneOffset() * 60 * 1000; // local time
	var day = msecs / (24 * 60 * 60 * 1000);
	day -= day % 1;
	return day;
}

function pad(date_obj) {
	if(date_obj.valueOf() < 10) return "0" + date_obj.valueOf();
	else return "" + date_obj.valueOf();
}

function loopThroughTextNodes(node) {
	if(node.childNodes && node.childNodes.length && node.childNodes.length > 0) {
		var i;
		for (i=0; i<node.childNodes.length; i++) {
			loopThroughTextNodes(node.childNodes);
		}
	} else if(node.nodeType == 3 && node.textContent && node.length > 0) {
		node.textContent = node.textContent.replace(/(\d\d:\d\d), (\d\d?) ({3,9}) (\d\d\d\d) \(UTC\)/ig, replaceDates);
	}
}

var now = new Date();
var months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", 
"November", "December"];
var days = ;

var talk_page = false;
var content_id = '';
var wgNamespaceNumber = mw.config.get('wgNamespaceNumber');
var wgAction = mw.config.get('wgAction');
if(wgNamespaceNumber > 0 && (wgNamespaceNumber < 6 || wgNamespaceNumber % 2 == 1) &&
( wgAction == "view" || wgAction == "edit" || wgAction == "submit") ) {
	
	if(document.getElementById('wpTextbox1') || document.getElementById('wpTextbox2')) {
		if(document.getElementById('wikiPreview')) {
			talk_page = true;
			content_id = 'wikiPreview';
		}
	} else {
		talk_page = true;
		content_id = 'bodyContent';
	}
}

if(talk_page && document.getElementById(content_id)) {
	loopThroughTextNodes(document.getElementById(content_id));
}