vjdw / Force microsoft.com sites to en-gb

// ==UserScript==
// @copyright 2020, vjdw (https://openuserjs.org/users/vjdw)
// @license MIT
// @namespace http://unclassified.software/
// @name Force microsoft.com sites to en-gb
// @description Fixes annoying date format by redirecting en-US Microsoft sites to en-GB
// @version 1.0
// @include http://*.microsoft.com/*
// @include https://*.microsoft.com/*
// @run-at document-start
// ==/UserScript==

(function() {

    // https://docs.microsoft.com/en-us/.../
    var matches = location.pathname.match(/^\/en\-([a-z]{2})\//i);
 	if (matches)
 	{
 		var locale = matches[1];
 		if (locale && !locale.match(/gb/i))
 		{
 			var newUrl = location.href.replace("/en-us/", "/en-gb/");
 			location.replace(newUrl);
 			return;
 		}
 	}

})()