Skip to content
Snippets Groups Projects

Gitlab 24h Time UserScript

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Jan Loewe

    Installation

    1. Install Tampermonkey (Firefox, Chrome, ...)
    2. Open this url and install the UserScript
    Edited
    gitlab-24h-time.user.js 1.05 KiB
    // ==UserScript==
    // @name         Gitlab 24h Time
    // @namespace    https://jloewe.net
    // @version      0.1
    // @description  Format dates on Gitlab using the german date format
    // @author       Jan Loewe
    // @match        https://gitlab.com/*
    // @match        https://gitlab1.ptb.de/*
    // @icon         https://gitlab.com/favicon.ico
    // @updateURL	 https://gitlab1.ptb.de/-/snippets/66/raw/main/gitlab-24h-time.user.js
    // @grant        none
    // ==/UserScript==
    
    // This code is based on the UserScript by Benjamin Bock (https://gitlab.com/bnjmnbck)
    // see https://gitlab.com/gitlab-org/gitlab/-/issues/15206#note_847008519
    
    function format(date) {
        if(!date) return;
        return date.toLocaleString("de-DE", { year: "numeric", month: "2-digit", day: "2-digit", hour:"2-digit", minute: "2-digit", second: "2-digit"});
    }
    
    function fixTime() {
        document.querySelectorAll("time").forEach(e => {e.innerHTML = format(new Date(e.getAttribute("datetime"))) })
    }
    
    (function() {
        'use strict';
    
        fixTime();
        setTimeout(fixTime, 100);
        setTimeout(fixTime, 300);
    })();
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment