Plugin Countdown

This wiki plugin displays a countdown to a future date from a date in the past, together with default or custom text if desired.

See also: PluginCountup

Parameters

Display the time until or after a date and time
Introduced in Tiki 1. Required parameters are in bold.
Go to the source code
Preferences required: wikiplugin_countdown

Parameters Accepted Values Description Default Since
(body of plugin) Text to append to the countdown.
enddate datetime Target date and time. Multiple formats accepted. 1
caldays (blank)
y
n
Will use calendar day difference when set to Yes (y) and time units are not shown. Result is that tomorrow, for example, is always shown as a one day away even if less than 24 hours from now. No (n) is the default. n 9.0
since (blank)
y
n
If Yes (y), will display amount of time since the event (default). If No (n) and if there is body text, will display "is over" or custom text set in text parameter after body text. 4.2
show (blank)| y| yo| yod| yodh| yodhm| yodhms| o| od| odh| odhm| odhms| d| dh| dhm| dhms| h| hm| hms| m| ms| s Select: y=years, o=months, d=days, h=hours, m=minutes, s=seconds. Enter multiple values as: yodhms. Must be in the order of descending length, and a time unit should not be skipped. If blank, the time is shown down to the hour if not zero. 4.2
text Text that will show with the countdown and body text. Set to default or leave empty to show "xxx days until/since body text", except that if the since parameter is set to No (n), "body text is over" will show after the end date has passed. Also, if no time is shown because of the time units being displayed (for example, only years are shown and it's less than a year before/after the end date) then "body text will happen in less than a year/happened in the last year" will show. Or set pipe-separated custom text as follows: before date|before date by less than shortest time unit shown|after date |after date by less than shortest time unit shown|after date and since set to No (n). Set to silent for no text. 9.0
thousands (blank)
c
p
s
Set the thousands separator for results of 1,000 or more. Choices are comma (c), decimal (d), space (s), or leave blank for no separator. 9.0

Examples

1. This code,
Copy to clipboard
{COUNTDOWN(enddate="01-Apr-2020")} __the project is done!__ {COUNTDOWN}

arrow-right.png
Would produce:
the project is done! is over
2. This code,
Copy to clipboard
{COUNTDOWN(enddate="2020-03-05T22:00" show="m")} __the project is done!__ {COUNTDOWN}

arrow-right.png
Would produce:
the project is done! is over
3. This code,
Copy to clipboard
{COUNTDOWN(enddate="01-Apr-2020" caldays="y" show="yod")} __the project is done!__ {COUNTDOWN}

arrow-right.png
Would produce:
the project is done! is over
 Note for above example
Uses caldays to count calendar days even if less than 24 hours away

4. This code,
Copy to clipboard
{COUNTDOWN(enddate="01-Apr-2010" since="n" text="before|is happening in less than a month|after|happened way less than a month ago|has passed")} __the project start date__ {COUNTDOWN}

arrow-right.png
Would produce:
the project start date has passed
 Note for above example
Show custom text instead of time elapsed for a date in the past.

5. This code,
Copy to clipboard
{COUNTDOWN(enddate="01-Apr-2010" since="y" show="yodhms")} __the project start date__ {COUNTDOWN}

arrow-right.png
Would produce:
14 years, 7 months, 2 days, 23 hours, 3 minutes and 53 seconds since the project start date
 Note for above example
Show time elapsed since a date in the past down to the second


If you want to automatically refresh the page every 60 seconds you could either use this code:

Copy to clipboard
{HTML()}<meta http-equiv="refresh" content="60">{HTML}


or get a JavaScript or jQuery plugin to get this done, maybe an Ajax call for the plugin .... if you find a better method than above, please feel free to document here.