Template:ArcaneDateCalculator

From CinderCivs Wiki
Revision as of 12:39, 9 February 2025 by Nex23 (talk | contribs) (Created page with "<div class="arcane-date-calculator" style="border:1px solid #aaa; background:#f9f9f9; padding:10px; max-width:350px;"> <div style="text-align:center; font-weight:bold; font-size:110%; margin-bottom:5px;">Arcane Calendar Calculator</div> <label for="arcane-year">Year:</label> <input type="number" id="arcane-year" min="1" style="width:60px;"> <label for="arcane-month">Month:</label> <input type="number" id="arcane-month" min="1" max="12" style="width:...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Arcane Calendar Calculator
   <label for="arcane-year">Year:</label>
   <input type="number" id="arcane-year" min="1" style="width:60px;">
   <label for="arcane-month">Month:</label>
   <input type="number" id="arcane-month" min="1" max="12" style="width:50px;">
   <label for="arcane-day">Day:</label>
   <input type="number" id="arcane-day" min="1" max="31" style="width:50px;">
   <button onclick="convertArcaneDate()" style="margin-left:5px;">Convert</button>

<script> function convertArcaneDate() {

   var year = document.getElementById("arcane-year").value;
   var month = document.getElementById("arcane-month").value;
   var day = document.getElementById("arcane-day").value;
   if (!year || !month || !day) {
       document.getElementById("arcane-date-output").innerHTML = "Please enter a valid date.";
       return;
   }
   var apiUrl = mw.util.wikiScript('api') + '?action=expandtemplates&format=json&text=Invalid date input. Please provide year, month, and day.';
   fetch(apiUrl)
       .then(response => response.json())
       .then(data => {
           document.getElementById("arcane-date-output").innerHTML = data.expandtemplates["*"];
       })
       .catch(error => {
           console.error("Error fetching Arcane Calendar date:", error);
           document.getElementById("arcane-date-output").innerHTML = "Error converting date.";
       });

} </script>