neige d'aout

knowledge, art, and other stuff

User Tools

Site Tools


solartime

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
solartime [2026/02/20 01:50] Yukisolartime [2026/02/20 16:39] (current) Yuki
Line 5: Line 5:
   font-family: "7segment";   font-family: "7segment";
   src: url("https://torinak.com/font/7segment.woff") format("woff2");   src: url("https://torinak.com/font/7segment.woff") format("woff2");
 +}
 +#clock
 +{
 +  text-align: center;
 } }
 #output #output
Line 10: Line 14:
   font-family: "7segment";   font-family: "7segment";
   font-size: 12em;   font-size: 12em;
-  text-aligncenter;+  background: #000; 
 +  padding: 0 0.1em; 
 +  color: #fcc; 
 +  text-shadow0 0 5px #fcc, 0 0 10px #fcc, 0 0 15px #fcc, 0 0 20px #f00, 0 0 30px #f00, 0 0 40px #f00, 0 0 55px #f00, 0 0 75px #f00; 
 +}
 } }
 </style> </style>
Line 19: Line 27:
   </button>   </button>
 </geolocation> </geolocation>
-Latitude: <input id="zone" value="-71.25"/> +Longitude: <input id="zone" type="number" value="-71.25" min="-180" max="180" step="any"/
-<div id="output">00:00:00</div>+ GMT<span id="gmt">+00:00:00</span
 +<div id="clock"><span id="output">00:00:00</span></div>
 <script src="https://unpkg.com/@js-temporal/polyfill/dist/index.umd.js"></script> <script src="https://unpkg.com/@js-temporal/polyfill/dist/index.umd.js"></script>
 <script> <script>
 setInterval(()=>{ setInterval(()=>{
   var instant = temporal.Temporal.Now.instant();   var instant = temporal.Temporal.Now.instant();
-  var time = parseFloat(document.querySelector("#zone").value);+  var time = parseFloat(document.querySelector("#zone").value)||0;
   var zone = temporal.Temporal.Duration.from({nanoseconds: Math.floor(time*240000000000)})   var zone = temporal.Temporal.Duration.from({nanoseconds: Math.floor(time*240000000000)})
 +  var gmt = temporal.Temporal.Instant.fromEpochNanoseconds(BigInt(Math.floor(Math.abs(time)*240000000000)))
   instant=instant.add(zone);   instant=instant.add(zone);
-  document.querySelector("#output").innerHTML = instant.toZonedDateTimeISO("GMT").toPlainTime().toLocaleString();+  document.querySelector("#output").innerHTML = instant.toZonedDateTimeISO("GMT").toPlainTime().toLocaleString("fr-FR"); 
 +  document.querySelector("#gmt").innerHTML = (zone.sign>=0?'+':'-')+gmt.toZonedDateTimeISO("GMT").toPlainTime().toLocaleString("fr-FR");
 }, 100); }, 100);
  
solartime.1771570252.txt.gz · Last modified: by Yuki