Template talk:Countdown
Automatic refresh?
[edit]I'm interested to use this on the sister Wikivoyage project.
The values only appear to update whenever the host article using the template is edited.
Is there anyway to have the values refresh at least once a day? Andrewssi2 (talk) 23:17, 1 April 2015 (UTC)
- There is nothing you can place in the page source to make it update regularly by itself. A purge will update the page. You could for example place wikivoyage:Template:Purge next to uses. In the English Wikipedia User:Joe's Null Bot is coded to automatically purge some pages regularly. I don't know whether Wikivoyage has bots which can do this or a place to request it. PrimeHunter (talk) 01:53, 2 April 2015 (UTC)
Inappropriate precision
[edit]The 'East Coast Belly Dance Cruise' countdown in the template's documentation page is timed from a start date: |year=2016
, |month=12
, |day=12
. Without a start time, it seems to me that countdown hours, minutes, and seconds are unknown and so should not be part of the rendered display.
I have modified a sandbox version of the module so that the display precision is more (I think) appropriate:
{{countdown/sandbox |year=2016 |month=12 |day=12}}
- →Error: year, month, and day must be specified
{{countdown/sandbox |year=2016 |month=12 |day=12 |hour=12}}
- →Error: year, month, and day must be specified
{{countdown/sandbox |year=2016 |month=12 |day=12 |hour=12 |minute=30}}
- →Error: year, month, and day must be specified
{{countdown/sandbox |year=2016 |month=12 |day=12 |hour=12 |minute=30 |second=7}}
- →Error: year, month, and day must be specified
- Server time is: 18:39:55
While this change is also applied to the post-event call to formatMessage()
, that section of the code needs additional work because of the undocumented parameters it uses and to make sure it does the right thing when those parameters aren't set in the template.
—Trappist the monk (talk) 15:38, 11 April 2015 (UTC)
- I understand your point, and I still think the precision is appropriate for the last 24 hours. Is there a way we can have the template only include that precision if the largest time span provided results in < 1? For example, if only year and month is provided, then weeks, days, hours shouldn't be rendered until there is < a month left. —
{{U|Technical 13}} (e • t • c)
16:07, 11 April 2015 (UTC)
- Point. I've tweaked the module so that when there are less than 24 hours remaining, the template displays remaining hours, minutes, and seconds even if a start time is not specified:
{{countdown/sandbox |year={{#time:Y|tomorrow}} |month={{#time:n|tomorrow}} |day={{#time:j|tomorrow}} |hour= |minute= |second=}}
- →Error: year, month, and day must be specified
- I also tweaked the default hours back to zero.
os.time()
uses 12 hours as the default if|hour=
is not specified.
- And why doesn't
lang:formatDuration ()
understand'months'
as an output option? How many people measure time in more than a few weeks before shifting to months?
- Point. I've tweaked the module so that when there are less than 24 hours remaining, the template displays remaining hours, minutes, and seconds even if a start time is not specified:
- It would seem a good thing to do to support an event timezone parameter so that editors don't have to calculate UTC from some specific local time.
- —Trappist the monk (talk) 17:32, 11 April 2015 (UTC)
- I'm guessing as to months that it has to do with inconsistency in the length of a month. There are a few ways to deal with the issue, none of them are perfect and it will be a matter of preference as to which we use. I personally define it as 30.4375 days. I'm a passenger in a vehicle on a 1 hour ride with a nearly dead battery. Will look again once I get home. —
{{U|Technical 13}} (e • t • c)
19:09, 11 April 2015 (UTC)
- I'm guessing as to months that it has to do with inconsistency in the length of a month. There are a few ways to deal with the issue, none of them are perfect and it will be a matter of preference as to which we use. I personally define it as 30.4375 days. I'm a passenger in a vehicle on a 1 hour ride with a nearly dead battery. Will look again once I get home. —
- —Trappist the monk (talk) 17:32, 11 April 2015 (UTC)
countdown-ymd (ex countdown/sandbox2)
[edit]- the following discussions refer to what was
{{countdown/sandbox2}}
and is now{{countdown-ymd/sandbox}}
. Further discussion should take place at that template's talk page—Trappist the monk (talk) 15:28, 28 April 2015 (UTC)
- the following discussions refer to what was
Extended content
|
---|
Yesterday I hacked a version of I think that this code works. In the following examples, the countdowns are listed in live, sandbox, and sandbox2 order. Countdown to tomorrow at 18:00:00
Countdown to 2025-05-29 at 18:00:00
Countdown to 2025-11-29 at 18:00:00
Notice the difference in the displayed times. You should be able to add the time this page was last refreshed to the countdown time and arrive at a sum of 18:00:00. I'm beginning to think that maybe there is a problem with As you can see, I changed the default text to be less wordy. —Trappist the monk (talk) 12:55, 13 April 2015 (UTC) I've added
—Trappist the monk (talk) 00:41, 14 April 2015 (UTC)
adjacent text[edit]It seems to me that editors should have more flexibility when it comes to the text surrounding the countdown. So I invented some parameters:
And some examples:
Further, because this version of |
Problem in module with parentheses
[edit]I noticed that simple usage like {{countdown|year=2015|month=1|day=1}}
(date is in the past) gave "Lua error: bad argument #1 to 'ucfirst' (string expected, got nil)." I fixed that with some adjustment of the parentheses. Some other problems of the same nature still exist but I couldn't work out exactly what was wanted from the code so I left it for now. At any rate, when an event is in progress, the module attempts to show something like "There are 2 days until the event ends". However, that never happens because of a precedence problem which needs some parentheses to fix. I would have fixed it but I can't see why "or
" was used at all and my thinking time has ended for now. The following shows that an "in progress event" does not currently display when it ends. This uses fixed wikitext so it won't change if the module is updated.
{{countdown|year=2015|month=1|day=1|duration=365|duration unit=day|eventstart=EVENT START|eventend=EVENT END}}
→EVENT START (refresh)
Johnuniq (talk) 03:50, 18 November 2015 (UTC)
Support refresh=no to disable the (refresh) button
[edit]This would be useful when it's used in other templates with another refresh/purge button already present. Maybe User:Johnuniq can help here? Headbomb {t · c · p · b} 15:03, 1 April 2019 (UTC)
- @Headbomb: I fixed the problem I mentioned in the section immediately above this, and I implemented
|refresh=no
. The following demonstrates both. At the time I am posting this, the event is in progress and that did not work before.{{countdown|year=2019|month=3|day=1|duration=200|duration unit=day}}
→ The event has ended. (refresh){{countdown|year=2019|month=3|day=1|duration=200|duration unit=day|refresh=no}}
→ The event has ended.
- Johnuniq (talk) 06:50, 2 April 2019 (UTC)
Countdown of other values
[edit]Hi there I wanted to add to the Climate Clock countdown also the CO2-budget countdown, but I wouldnt know if there is a way to do a countdown that reduces the remaining CO2-budget with every update, instead of years/days/hours/minutes/seconds. But you would need to be able to define an amount of reduction per time unit. Something like the bottom countdown at this site: https://www.mcc-berlin.net/fileadmin/data/clock/carbon_clock.htm Nsae Comp
Does anyone know a way?