From Dark and Darker Wiki

No edit summary
No edit summary
 
Line 10: Line 10:
     let timezoneOffset = new Date().getTimezoneOffset()*60*1000;
     let timezoneOffset = new Date().getTimezoneOffset()*60*1000;
     let countDownDate = new Date('<!--{$date|escape:'quotes'}-->').getTime();
     let countDownDate = new Date('<!--{$date|escape:'quotes'}-->').getTime();
     let now = new Date().getTime();
     let now = new Date().getTime() + timezoneOffset;
     let distance = countDownDate - now + timezoneOffset;
     let distance = countDownDate - now;
     let days = Math.floor(distance / (1000 * 60 * 60 * 24));
     let days = Math.floor(distance / (1000 * 60 * 60 * 24));
     let hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
     let hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
Line 40: Line 40:


==Example 2==
==Example 2==
<pre>{{#widget:Countdown|uniqueId=B|date=2024-12-31 23:59:59}}</pre>
<pre>{{#widget:Countdown|uniqueId=B|date=2024-12-10 20:00:00}}</pre>
{{#widget:Countdown|uniqueId=B|date=2024-12-10 20:00:00}}
{{#widget:Countdown|uniqueId=B|date=2024-12-10 20:00:00}}



Latest revision as of 18:44, 10 December 2024

Parameters

uniqueId
  • Determines element id name
  • Name needs to be unique if multiple widgets are to be displayed on the same page.
  • Default: timer
date
  • String of text indicating a date and time.
    • Example:2024-12-31 23:59:59

Example 1

{{#widget:Countdown|uniqueId=A|date=2025-08-26 23:59:59}}

Example 2

{{#widget:Countdown|uniqueId=B|date=2024-12-10 20:00:00}}

Example 3

{{#widget:Countdown|uniqueId=C|date=2024-08-24 23:59:59}}