eileen12 / ShanaProject Fixes

// ==UserScript==
// @name         ShanaProject Fixes
// @namespace    shana_scripts
// @version      0.11
// @description  Fix release date to use local timezone.
// @author       eileen12
// @match        http*://*.shanaproject.com/*
// @updateURL    https://openuserjs.org/meta/eileen12/ShanaProject_Fixes.meta.js
// @copyright    2020, eileen12 (https://openuserjs.org/users/eileen12)
// @license      MIT
// ==/UserScript==

var parse_date = date_str => new Date(date_str.replace(/([0-9]*)[:]?([0-9]*) ([ap]).m./i, "$1:$2 $3m"))
function fixDates()
{
    Array.from(document.querySelectorAll(".release_20.release_last"))
        .forEach(e => {
            var dt = parse_date(e.innerHTML.trim() + " UTC")
            if(!isNaN(dt))
            {
                e.title = e.innerHTML + " UTC"
                e.innerHTML = new Intl.DateTimeFormat(undefined, {
                    timeStyle: 'short',
                    dateStyle: 'medium',
                    //timeZone: 'UTC'
                }).format(dt)
            }
        })
}

(function() {
    'use strict';
    fixDates();
    // Your code here...
})();