JSFiddle - React, Tailwind, and code Playground

by Carlos Solís

HTML

<body>
    <div class="display">
         <h1>Decimal Time</h1>

         <h2>Worldwide decimal time:</h2>

         <p id="timeSpan">(loading)</p>
         <h2>Local decimal time:</h2>

         <p id="localTimeSpan">(loading)</p>
         <h3>For reference, the current legacy time is:</h3>

         <p id="legacyTimeSpan">(loading)</p>
         <h3>This page updates every centimilliday (0.864 seconds)</h3>

    </div>
    <hr/>
    <h2>What is decimal time?</h2>

    <p>Decimal time is a method to write and display a date and time in decimal notation, either worldwide or local based on legacy timezones.</p>
    <ul>
        <li>Years are counted from the Unix Epoch (Jan. 1st, 1970 in legacy time).</li>
        <li>Time is counted by number of days (counting from zero) elapsed during the year, plus the decimal fragment of day already elapsed up to five decimal digits (deciday, centiday, milliday, decimilliday, centimilliday respectively).</li>
        <li>As of yet, decimal time has been only implemented for terrestrial dates, hence the T suffix after the year.</li>
        <li>Worldwide time is indicated by an M suffix, while local timezones use a L prefix followed by the amount of offset that must be added or substracted in decimal time to reach legacy UTC.</li>
    </ul>
</body>

CSS

body {
    font-size: 1em;
    font-family:"DejaVu Sans", sans-serif;
}
.display, h1, h2, h3 {
    text-align: center;
}
#timeSpan, #localTimeSpan, #legacyTimeSpan {
    font-family: monospace;
    font-size: 1.5em;
}

JavaScript

//@license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt
        /*
         * @licstart  The following is the entire license notice for the
         * JavaScript code in this page.
         *
         * Copyright (C) 2013 Carlos Solís
         *
         * The JavaScript code in this page is free software: you can
         * redistribute it and/or modify it under the terms of the GNU
         * Affero General Public License (GNU AGPL) as published by the Free
         * Software Foundation, either version 3 of the License, or (at your
         * option) any later version.
         *
         * The code is distributed WITHOUT ANY WARRANTY; without even the
         * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
         * PURPOSE.  See the GNU AGPL for more details.
         *
         * As additional permission under GNU AGPL version 3 section 7, you
         * may distribute non-source (e.g., minimized or compacted) forms of
         * that code without the copy of the GNU AGPL normally required by
         * section 4, provided you include this license notice and a URL
         * through which recipients can access the Corresponding Source.
         *
         * @licend  The above is the entire license notice
         * for the JavaScript code in this page.
         */

        //You may download the original source code at
        //https://github.com/csolisr/decimalTime
        var decimalTime = function (date, isLocal, precision) {
            if (date == null) {
                date = new Date();
            }
            if (isLocal == null) {
                isLocal = false;
            }
            if (precision == null) {
                precision = 5;
            }
            if (isLocal) {
                var yr = date.getFullYear() - 1970;
                var mt = date.getMonth() + 1;
                var dy = date.getDate();
                var hr = date.getHours();
                var mn =...