ਸਮੱਗਰੀ 'ਤੇ ਜਾਓ

ਫਰਮਾ:Time ago/testcases

ਵਿਕੀਪੀਡੀਆ, ਇੱਕ ਆਜ਼ਾਦ ਵਿਸ਼ਵਕੋਸ਼ ਤੋਂ

Trailing space tests

[ਸੋਧੋ]

Purge

1 Jan 2012:

  • >14 ਸਾਲ ਪਹਿਲਾਂ<
  • >14 years ago<sbx

current time:

  • >0 ਸਕਿੰਟ ਪਹਿਲਾਂ<
  • >0 seconds ago<sbx

1 Jan 2012, with purge

current time with purge:

Line break test (no purge)

live>0 ਸਕਿੰਟ ਪਹਿਲਾਂ (ਤਾਜ਼ਾ ਕਰੋ) 0 ਸਕਿੰਟ ਪਹਿਲਾਂ (ਤਾਜ਼ਾ ਕਰੋ) 0 ਸਕਿੰਟ ਪਹਿਲਾਂ (ਤਾਜ਼ਾ ਕਰੋ) 0 ਸਕਿੰਟ ਪਹਿਲਾਂ (ਤਾਜ਼ਾ ਕਰੋ) 0 ਸਕਿੰਟ ਪਹਿਲਾਂ (ਤਾਜ਼ਾ ਕਰੋ) 0 ਸਕਿੰਟ ਪਹਿਲਾਂ (ਤਾਜ਼ਾ ਕਰੋ) 0 ਸਕਿੰਟ ਪਹਿਲਾਂ (ਤਾਜ਼ਾ ਕਰੋ) 0 ਸਕਿੰਟ ਪਹਿਲਾਂ (ਤਾਜ਼ਾ ਕਰੋ) 0 ਸਕਿੰਟ ਪਹਿਲਾਂ (ਤਾਜ਼ਾ ਕਰੋ) 0 ਸਕਿੰਟ ਪਹਿਲਾਂ (ਤਾਜ਼ਾ ਕਰੋ) 0 ਸਕਿੰਟ ਪਹਿਲਾਂ (ਤਾਜ਼ਾ ਕਰੋ) 0 ਸਕਿੰਟ ਪਹਿਲਾਂ (ਤਾਜ਼ਾ ਕਰੋ)<<

sbx>0 seconds ago (purge) 0 seconds ago (purge) 0 seconds ago (purge) 0 seconds ago (purge) 0 seconds ago (purge) 0 seconds ago (purge) 0 seconds ago (purge) 0 seconds ago (purge) 0 seconds ago (purge) 0 seconds ago (purge) 0 seconds ago (purge) 0 seconds ago (purge)<<

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

live>0 ਸਕਿੰਟ ਪਹਿਲਾਂ (ਤਾਜ਼ਾ ਕਰੋ) 0 ਸਕਿੰਟ ਪਹਿਲਾਂ (ਤਾਜ਼ਾ ਕਰੋ) 0 ਸਕਿੰਟ ਪਹਿਲਾਂ (ਤਾਜ਼ਾ ਕਰੋ) 0 ਸਕਿੰਟ ਪਹਿਲਾਂ (ਤਾਜ਼ਾ ਕਰੋ) 0 ਸਕਿੰਟ ਪਹਿਲਾਂ (ਤਾਜ਼ਾ ਕਰੋ) 0 ਸਕਿੰਟ ਪਹਿਲਾਂ (ਤਾਜ਼ਾ ਕਰੋ) 0 ਸਕਿੰਟ ਪਹਿਲਾਂ (ਤਾਜ਼ਾ ਕਰੋ) 0 ਸਕਿੰਟ ਪਹਿਲਾਂ (ਤਾਜ਼ਾ ਕਰੋ) 0 ਸਕਿੰਟ ਪਹਿਲਾਂ (ਤਾਜ਼ਾ ਕਰੋ) 0 ਸਕਿੰਟ ਪਹਿਲਾਂ (ਤਾਜ਼ਾ ਕਰੋ) 0 ਸਕਿੰਟ ਪਹਿਲਾਂ (ਤਾਜ਼ਾ ਕਰੋ) 0 ਸਕਿੰਟ ਪਹਿਲਾਂ (ਤਾਜ਼ਾ ਕਰੋ)<<

sbx>0 seconds ago (purge) 0 seconds ago (purge) 0 seconds ago (purge) 0 seconds ago (purge) 0 seconds ago (purge) 0 seconds ago (purge) 0 seconds ago (purge) 0 seconds ago (purge) 0 seconds ago (purge) 0 seconds ago (purge) 0 seconds ago (purge) 0 seconds ago (purge)<<

Sandbox tests

[ਸੋਧੋ]
  • Normal: 16 years ago
  • Minutes: 8910414 minutes ago
  • Days: 6187 days ago
  • Weeks: 883 weeks ago
  • Months: 203 months ago
  • Future: 276 months' time

Errors

[ਸੋਧੋ]
  • Bad date: Error: first parameter cannot be parsed as a date or time.
  • Unknown specified magnitude: 534624846 seconds ago
  • No parameters: 0 seconds ago
  • Capitalization: 534624846 seconds ago

min_magnitude

[ਸੋਧੋ]
nosecondsminuteshoursdaysmonthsyearsnonsense
-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
9 ਜੂਨ 2026 Error: first parameter cannot be parsed as a date or time. Error: first parameter cannot be parsed as a date or time. Error: first parameter cannot be parsed as a date or time. Error: first parameter cannot be parsed as a date or time. Error: first parameter cannot be parsed as a date or time. Error: first parameter cannot be parsed as a date or time. Error: first parameter cannot be parsed as a date or time. Error: first parameter cannot be parsed as a date or time.
-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 16 years ago 16 years ago 16 years ago 16 years ago 16 years ago 16 years ago 16 years ago 16 years ago
17 November 2009 16 years ago 16 years ago 16 years ago 16 years ago 16 years ago 16 years ago 16 years ago 16 years ago
20 May 1988 38 years ago 38 years ago 38 years ago 38 years ago 38 years ago 38 years ago 38 years ago 38 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

Original version tests

[ਸੋਧੋ]
  • Normal: 16 ਸਾਲ ਪਹਿਲਾਂ
  • Minutes: 534624846 ਸਕਿੰਟ ਪਹਿਲਾਂ
  • Days: 534624846 ਸਕਿੰਟ ਪਹਿਲਾਂ
  • Weeks: 534624846 ਸਕਿੰਟ ਪਹਿਲਾਂ
  • Months: 534624846 ਸਕਿੰਟ ਪਹਿਲਾਂ
  • Future: 727679154 ਸਕਿੰਟਾਂ ਦਾ ਸਮਾਂ

Errors

[ਸੋਧੋ]
  • Bad date: Error: first parameter cannot be parsed as a date or time.
  • Unknown specified magnitude: 534624846 ਸਕਿੰਟ ਪਹਿਲਾਂ
  • No parameters: 0 ਸਕਿੰਟ ਪਹਿਲਾਂ
  • Capitalization: 534624846 ਸਕਿੰਟ ਪਹਿਲਾਂ

min_magnitude

[ਸੋਧੋ]
nosecondsminuteshoursdaysmonthsyearsnonsense
-111 seconds 111 ਸਕਿੰਟ ਪਹਿਲਾਂ 111 ਸਕਿੰਟ ਪਹਿਲਾਂ 111 ਸਕਿੰਟ ਪਹਿਲਾਂ 111 ਸਕਿੰਟ ਪਹਿਲਾਂ 111 ਸਕਿੰਟ ਪਹਿਲਾਂ 111 ਸਕਿੰਟ ਪਹਿਲਾਂ 111 ਸਕਿੰਟ ਪਹਿਲਾਂ 111 ਸਕਿੰਟ ਪਹਿਲਾਂ
-30 minutes 30 ਮਿੰਟ ਪਹਿਲਾਂ 30 ਮਿੰਟ ਪਹਿਲਾਂ 30 ਮਿੰਟ ਪਹਿਲਾਂ 30 ਮਿੰਟ ਪਹਿਲਾਂ 30 ਮਿੰਟ ਪਹਿਲਾਂ 30 ਮਿੰਟ ਪਹਿਲਾਂ 30 ਮਿੰਟ ਪਹਿਲਾਂ 30 ਮਿੰਟ ਪਹਿਲਾਂ
9 ਜੂਨ 2026 Error: first parameter cannot be parsed as a date or time. Error: first parameter cannot be parsed as a date or time. Error: first parameter cannot be parsed as a date or time. Error: first parameter cannot be parsed as a date or time. Error: first parameter cannot be parsed as a date or time. Error: first parameter cannot be parsed as a date or time. Error: first parameter cannot be parsed as a date or time. Error: first parameter cannot be parsed as a date or time.
-25 hours 25 ਘੰਟੇ ਪਹਿਲਾਂ 25 ਘੰਟੇ ਪਹਿਲਾਂ 25 ਘੰਟੇ ਪਹਿਲਾਂ 25 ਘੰਟੇ ਪਹਿਲਾਂ 25 ਘੰਟੇ ਪਹਿਲਾਂ 25 ਘੰਟੇ ਪਹਿਲਾਂ 25 ਘੰਟੇ ਪਹਿਲਾਂ 25 ਘੰਟੇ ਪਹਿਲਾਂ
1 January 2010 16 ਸਾਲ ਪਹਿਲਾਂ 16 ਸਾਲ ਪਹਿਲਾਂ 16 ਸਾਲ ਪਹਿਲਾਂ 16 ਸਾਲ ਪਹਿਲਾਂ 16 ਸਾਲ ਪਹਿਲਾਂ 16 ਸਾਲ ਪਹਿਲਾਂ 16 ਸਾਲ ਪਹਿਲਾਂ 16 ਸਾਲ ਪਹਿਲਾਂ
17 November 2009 16 ਸਾਲ ਪਹਿਲਾਂ 16 ਸਾਲ ਪਹਿਲਾਂ 16 ਸਾਲ ਪਹਿਲਾਂ 16 ਸਾਲ ਪਹਿਲਾਂ 16 ਸਾਲ ਪਹਿਲਾਂ 16 ਸਾਲ ਪਹਿਲਾਂ 16 ਸਾਲ ਪਹਿਲਾਂ 16 ਸਾਲ ਪਹਿਲਾਂ
20 May 1988 38 ਸਾਲ ਪਹਿਲਾਂ 38 ਸਾਲ ਪਹਿਲਾਂ 38 ਸਾਲ ਪਹਿਲਾਂ 38 ਸਾਲ ਪਹਿਲਾਂ 38 ਸਾਲ ਪਹਿਲਾਂ 38 ਸਾਲ ਪਹਿਲਾਂ 38 ਸਾਲ ਪਹਿਲਾਂ 38 ਸਾਲ ਪਹਿਲਾਂ
5 months Lua error in ਮੌਡਿਊਲ:Time_ago at line 98: attempt to index field '?' (a nil value). Lua error in ਮੌਡਿਊਲ:Time_ago at line 98: attempt to index field '?' (a nil value). Lua error in ਮੌਡਿਊਲ:Time_ago at line 98: attempt to index field '?' (a nil value). Lua error in ਮੌਡਿਊਲ:Time_ago at line 98: attempt to index field '?' (a nil value). Lua error in ਮੌਡਿਊਲ:Time_ago at line 98: attempt to index field '?' (a nil value). Lua error in ਮੌਡਿਊਲ:Time_ago at line 98: attempt to index field '?' (a nil value). Lua error in ਮੌਡਿਊਲ:Time_ago at line 98: attempt to index field '?' (a nil value). Lua error in ਮੌਡਿਊਲ:Time_ago at line 98: attempt to index field '?' (a nil value).

Now works in the future

[ਸੋਧੋ]
  • Original: 31 ਸਾਲਾਂ ਦਾ ਸਮਾਂ
  • Sandbox: 31 years' time

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: 2026-06-09 06:54:06 (UTC). If that is not correct, click Purge to update the page.

Example Current output Sandbox output
{{Time ago|-13 months|min_magnitude=years}}
Lua error in ਮੌਡਿਊਲ:Time_ago at line 98: attempt to index field '?' (a nil value).
1 year ago
{{Time ago|-32 days|min_magnitude=months}}
31 ਦਿਨ ਪਹਿਲਾਂ
1 month ago
{{Time ago|-25 hours|min_magnitude=days}}
25 ਘੰਟੇ ਪਹਿਲਾਂ
1 day ago
{{Time ago|-65 minutes|min_magnitude=hours}}
64 ਮਿੰਟ ਪਹਿਲਾਂ
1 hour ago
{{Time ago|-75 seconds|min_magnitude=minutes}}
74 ਸਕਿੰਟ ਪਹਿਲਾਂ
1 minute ago
{{Time ago|-15 seconds|min_magnitude=seconds}}
14 ਸਕਿੰਟ ਪਹਿਲਾਂ
14 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 41 ਸਾਲ ਪਹਿਲਾਂ.

Sandbox

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

Blank future values of ago

[ਸੋਧੋ]
  • {{time ago|1 January {{#expr: {{CURRENTYEAR}} + 5}}|ago=}}
Main

4 ਸਾਲਾਂ ਦਾ ਸਮਾਂ

Sandbox

4 years

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

2 ਸਕਿੰਟਾਂ ਦਾ ਸਮਾਂ

Sandbox

2 seconds

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

[ਸੋਧੋ]


{{Time ago}}

0 ਸਕਿੰਟ ਪਹਿਲਾਂ

{{Time ago/sandbox}}

0 seconds ago

{{Time ago}}

0 ਸਕਿੰਟ ਪਹਿਲਾਂ

{{Time ago/sandbox}}

0 seconds ago

{{Time ago}}

0 ਸਕਿੰਟ ਪਹਿਲਾਂ

{{Time ago/sandbox}}

0 seconds ago

{{Time ago}}

0 ਸਕਿੰਟ ਪਹਿਲਾਂ

{{Time ago/sandbox}}

0 seconds ago

{{Time ago}}

0 ਸਕਿੰਟ ਪਹਿਲਾਂ

{{Time ago/sandbox}}

0 seconds ago

{{Time ago}}

0 ਸਕਿੰਟ ਪਹਿਲਾਂ

{{Time ago/sandbox}}

0 seconds ago

{{Time ago}}

0 ਸਕਿੰਟ ਪਹਿਲਾਂ

{{Time ago/sandbox}}

0 seconds ago

{{Time ago}}

0 ਸਕਿੰਟ ਪਹਿਲਾਂ

{{Time ago/sandbox}}

0 seconds ago

{{Time ago}}

0 ਸਕਿੰਟ ਪਹਿਲਾਂ

{{Time ago/sandbox}}

0 seconds ago