fix time and translate datetime title

This commit is contained in:
vv01f 2023-01-12 13:00:55 +01:00
parent c6d25eeb7c
commit f9fd94662b
1 changed files with 12 additions and 5 deletions

View File

@ -31,18 +31,24 @@ fieldset { border-color: black;}
</style>
<script type="module">
// You need to include rrule.js library to use this function
//~ import * as RRule from 'https://jakubroztocil.github.io/rrule/dist/es5/rrule.js';
import * as RRule from 'http://btc.bplaced.net/script/rrule.min.js';
import * as RRule from 'https://jakubroztocil.github.io/rrule/dist/es5/rrule.js';
//~ import * as RRule from 'http://btc.bplaced.net/script/rrule.min.js';
document.addEventListener("DOMContentLoaded", function(event) {
for(const tag of document.getElementsByTagName("time")){
var now = new Date();
var e = rrule.RRule.fromString(tag.getAttribute('datetime').toUpperCase()).after(now);
var rule = rrule.RRule.fromString(tag.getAttribute('datetime').toUpperCase());
var e = rule.after(now);
tag.setAttribute('datetime', new Date(e - -now.getTimezoneOffset()*60000).toISOString());
var f = new Intl.DateTimeFormat("de-DE", { //timeZoneName: "short", second: "numeric"
timeZone: "UTC", year: "numeric", month: "long", day: "2-digit", weekday: "long", hour: "numeric", minute: "numeric" }).format(e);
var f = new Intl.DateTimeFormat("de-DE", { //timeZoneName: "short", second: "numeric" | day: "2-digit"
timeZone: "UTC", year: "numeric", month: "long", day: "numeric", weekday: "long", hour: "numeric", minute: "numeric" }).format(e).replace(' um ',' ab ');
//~ console.log(f);
tag.innerHTML = "nächster Termin am" + f + "Uhr";
var title = rule.toText().replace('every day','jeden Tag').replace('every week','jede Woche').replace('every month','jeden Monat').replace('every year','jedes Jahr').replace('on the','am').replace('Monday','Montag').replace('Tuesday','Dienstag').replace('Wednesday','Mittwoch').replace('Thursday','Donnerstag').replace('Friday','Freitag').replace('Saturday','Samstag').replace('Sunday','Sonntag').replace('2nd','zweiten').replace('1st','ersten').replace('3rd','dritten').replace('4th','vierten') + " " + f.substr(f.lastIndexOf('ab '));
//~ console.log(title);
tag.setAttribute('title', title);
}
});
@ -75,6 +81,7 @@ document.addEventListener("DOMContentLoaded", function(event) {
<ul>
<li><a href="https://bitcoin-leipzig.de/" target="_blank">Bitcoin Leipzig</a> <time datetime="DTSTART=20131017T190000Z;FREQ=MONTHLY;BYDAY=3TH;BYHOUR=19;BYMINUTE=0;BYSECOND=0">jeweils monatlich am 3. Donnerstag ab 19 Uhr</time> im <a href="https://www.openstreetmap.org/node/3955657883" target="_blank">Café Uptown</a> (gelegentlich konnte auch mit Bitcoin gezahlt werden) und <em>Bitcoin Themenabend</em>: <time datetime="DTSTART=20171101T190000Z;FREQ=MONTHLY;BYDAY=1WE;BYHOUR=19;BYMINUTE=0;BYSECOND=0">jeden 1. Mittwoch ab 19 Uhr</time> im <a href="https://dezentrale.space/" target="_blank">Hackspace dezentrale</a></li><!-- https://bitcointalk.org/index.php?topic=308377.0 , https://bitcointalk.org/index.php?topic=2335694.0 -->
<li><a href="https://www.bitcoin-goerlitz.de/">Bitcoin-Meetup Görlitz</a>: <time datetime="DTSTART=20230116T190000Z;FREQ=MONTHLY;BYDAY=3MO;BYHOUR=19;BYMINUTE=0;BYSECOND=0">jeden 3. Montag ab 19 Uhr</time> in <a href="https://www.openstreetmap.org/node/8196458496">Jakobs Speiselokal</a></li>
<li><a href="https://t.me/einundzwanzigthueringen">Einundzwanzig Thüringen</a> an wechselnden Orten</li>
<li>Auch zu anderen Themen beim <a href="https://c3d2.de/space.html" target="_blank">Chaos Computer Club Dresden</a></li>
<li>Für solche mit robustem Magen: <a href="https://www.meetup.com/de-DE/BlockchainMeetupSaxony/" target="_blank">Blockchain Meetup Saxony</a></li>
<li><a href="https://www.meetup.com/de-DE/Bitcoin-Lab-Berlin/events/tmxjlsydcfbfb/" target="_blank">Berliner Bitcoin-Stammtisch</a>: <time datetime="DTSTART=20110714T190000Z;FREQ=MONTHLY;BYDAY=1WE;BYHOUR=19;BYMINUTE=0;BYSECOND=0">jeden 1. Donnerstag ab 19 Uhr</time> im <a href="https://www.friedelrichter.de/" target="_blank">Friedel Richter</a>, ggf. auch <a href="https://meet.fulmo.org/BitcoinStammtischBerlin" target="_blank">online</a></li>