Template:Time ago/testcases

< Template:Time ago
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Trailing space tests

Purge

1 Jan 2012:

current time:

1 Jan 2012, with purge

current time with purge:

Line break test (no purge)

Line break test (purge can appear at start of line)

Sandbox tests

Errors

min_magnitude

no seconds minutes hours days months years nonsense
-111 seconds Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox
-30 minutes Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox
4 November 2024 Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox
-25 hours Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox
1 January 2010 Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox
17 November 2009 Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox
20 May 1988 Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox
5 months Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox Template:Time ago/sandbox

Original version tests

  • Normal: 15 years ago
  • Minutes: 8072495 minutes ago
  • Days: 5605 days ago
  • Weeks: 800 weeks ago
  • Months: 184 months ago
  • Future: 295 months' time

Errors

  • Bad date: Error: first parameter cannot be parsed as a date or time.
  • Unknown specified magnitude: 484349755 seconds ago
  • No parameters: 0 seconds ago
  • Capitalization: 484349755 seconds ago

min_magnitude

no seconds minutes hours days months years nonsense
-111 seconds 111 seconds ago 111 seconds ago 1 minute ago 0 hours ago 0 days ago 0 months ago 0 years ago 111 seconds ago
-30 minutes 30 minutes ago 30 minutes ago 30 minutes ago 0 hours ago 0 days ago 0 months ago 0 years ago 30 minutes ago
4 November 2024 21 hours ago 21 hours ago 21 hours ago 21 hours ago 0 days ago 0 months ago 0 years ago 21 hours ago
-25 hours 25 hours ago 25 hours ago 25 hours ago 25 hours ago 1 day ago 0 months ago 0 years ago 25 hours ago
1 January 2010 14 years ago 14 years ago 14 years ago 14 years ago 14 years ago 14 years ago 14 years ago 14 years ago
17 November 2009 14 years ago 14 years ago 14 years ago 14 years ago 14 years ago 14 years ago 14 years ago 14 years ago
20 May 1988 36 years ago 36 years ago 36 years ago 36 years ago 36 years ago 36 years ago 36 years ago 36 years ago
5 months 5 months' time 5 months' time 5 months' time 5 months' time 5 months' time 5 months' time 0 years' time 5 months' time

Now works in the future

Non-breaking space

Test using a non-breaking space between the number and the units (year, month, day, etc). A breaking space is used between the units and "ago" (similar to the output of Template:Start date and years ago).

These examples are placed inside a narrow <div> to force a line break. They are based on the current date and time, which is: 2024-11-04 09:35:55 (UTC). If that is not correct, click Purge to update the page.

Example Current output Sandbox output
{{Time ago|-13 months|min_magnitude=years}}
1 year ago
{{Time ago|-32 days|min_magnitude=months}}
1 month ago
{{Time ago|-25 hours|min_magnitude=days}}
1 day ago
{{Time ago|-65 minutes|min_magnitude=hours}}
1 hour ago
{{Time ago|-75 seconds|min_magnitude=minutes}}
1 minute ago
{{Time ago|-15 seconds|min_magnitude=seconds}}
15 seconds ago

Blank values of ago

  • He has worked for FooBar Corp for the last {{time ago|1 January 1985|ago=}}.
Main

He has worked for FooBar Corp for the last 39 years.

Sandbox

He has worked for FooBar Corp for the last Template:Time ago/sandbox.

Blank future values of ago

  • {{time ago|1 January {{#expr: {{CURRENTYEAR}} + 5}}|ago=}}
Main

4 years

Sandbox

Template:Time ago/sandbox

  • {{time ago|{{#time:c|+ 1 second}}|ago=}}
Main

1 second

Sandbox

Template:Time ago/sandbox

Comparing hours, days, and weeks for the same time periods

{{Time ago|20241104213555|magnitude=hours}}
Current time
{{Time ago}}{{Time ago/sandbox}}
0 hours ago Error: expandTemplate: template "Time ago/sandbox" does not exist
{{Time ago|20241014000030|magnitude=hours}}
21 days ago at 30 seconds after midnight, display hours
{{Time ago}}{{Time ago/sandbox}}
525 hours ago Error: expandTemplate: template "Time ago/sandbox" does not exist
{{Time ago|20241014000130|magnitude=hours}}
21 days ago at 1:30 after midnight, display hours
{{Time ago}}{{Time ago/sandbox}}
525 hours ago Error: expandTemplate: template "Time ago/sandbox" does not exist
{{Time ago|20241014000030|magnitude=days}}
21 days ago at 30 seconds after midnight, display days
{{Time ago}}{{Time ago/sandbox}}
21 days ago Error: expandTemplate: template "Time ago/sandbox" does not exist
{{Time ago|20241014000130|magnitude=days}}
21 days ago at 1:30 after midnight, display days
{{Time ago}}{{Time ago/sandbox}}
21 days ago Error: expandTemplate: template "Time ago/sandbox" does not exist
{{Time ago|20241014000030|magnitude=weeks}}
21 days ago at 30 seconds after midnight, display weeks (erroneous output)
{{Time ago}}{{Time ago/sandbox}}
2 weeks ago Error: expandTemplate: template "Time ago/sandbox" does not exist
{{Time ago|20241014000130|magnitude=weeks}}
21 days ago at 1:30 after midnight, display weeks
{{Time ago}}{{Time ago/sandbox}}
3 weeks ago Error: expandTemplate: template "Time ago/sandbox" does not exist
{{Time ago|20240916000030|magnitude=weeks}}
49 days ago at 30 seconds after midnight, display weeks (erroneous output)
{{Time ago}}{{Time ago/sandbox}}
6 weeks ago Error: expandTemplate: template "Time ago/sandbox" does not exist
{{Time ago|20240916000130|magnitude=weeks}}
49 days ago at 1:30 after midnight, display weeks
{{Time ago}}{{Time ago/sandbox}}
7 weeks ago Error: expandTemplate: template "Time ago/sandbox" does not exist