قالب:فرز تاريخ
| صفحة القالب متضمنة في عدة صفحات ويمكن ملاحظتها على نطاق واسع. أختبر تغييرات القالب في /الملعب أو /المختبر أو صفحات فرعية، أو عبر صفحة المستخدم الفرعية. فكر في مناقشة التغييرات في صفحة نقاش قبل تنفيذها. |
| هذا القالب يستعمل لوا: |
فرز تاريخ يُستخدم لفرز وعرض التواريخ بشكل صحيح في جدول قابل للفرز (انظر فرز الجداول).
ما يحلّه
[عدل]التواريخ بصيغها المعتادة، إذا عُوملت ببساطة كسلاسل نصية أبجدية رقمية، يتم فرزها بطرق غير منطقية:
- 1 سبتمبر 1998 يُفرز أبجديًا قبل 5 مارس 1967، لأن 1 أصغر من 5؛
- 5 فبراير 1922 يُفرز أبجديًا قبل 3 يناير 1922، لأن F تأتي قبل J.
استخدام صيغة YYYY-MM-DD كان سيحل هذه المشكلة، لكن مع بعض الاستثناءات الطفيفة، هذه الصيغة لا تُستخدم في المقالات (انظر تنسيق التواريخ).
Parameters
[عدل]التواريخ
[عدل]| {{فرز تاريخ|سنة|شهر|يوم|BC}} | {{فرز تاريخ|تاريخ}} |
|---|---|
|
|
| أسلوب الإدخال | رمز الإدخال | مفتاح الفرز المخفي | المخرجات المرئية |
|---|---|---|---|
| {{فرز تاريخ|سنة}} | {{فرز تاريخ|1893}}
|
1893 | |
{{فرز تاريخ|-89}}
|
89 ق.م | ||
{{فرز تاريخ|-10000}}
|
10٬000 ق.م | ||
{{فرز تاريخ|-1}}
|
1 ق.م | ||
{{فرز تاريخ| 1}}
|
1 (Note that year 0 does not exist and gives error message) | ||
| {{فرز تاريخ|شهر}} | {{فرز تاريخ|Oct}}
|
أكتوبر | |
| {{فرز تاريخ|شهر سنة}} | {{فرز تاريخ|فبراير 1767}}
|
فبراير 1767 | |
| {{فرز تاريخ|يوم شهر سنة}} | {{فرز تاريخ|12 أغسطس 1987}}
|
12 أغسطس 1987 | |
| {{فرز تاريخ|شهر يوم, سنة}} | {{فرز تاريخ|July 1, 1867}}
|
يوليو 1, 1867 | |
| {{فرز تاريخ|يوم شهر}} | {{فرز تاريخ|25 October}}
|
25 أكتوبر | |
| {{فرز تاريخ|month day}} | {{فرز تاريخ|Jan 1}}
|
يناير 1 | |
| {{فرز تاريخ|YYYY-MM-DD}} | {{فرز تاريخ|2014-12-09}}
|
9 ديسمبر 2014 | |
| {{فرز تاريخ|DD-MM-YYYY}} | {{فرز تاريخ|15-05-2019}}
|
15 مايو 2019 | |
| {{فرز تاريخ|year|month}} | {{فرز تاريخ|1990|10}}
|
أكتوبر 1990 | |
{{فرز تاريخ|1980|Dec}}
|
ديسمبر 1980 | ||
{{فرز تاريخ|1970|August}}
|
أغسطس 1970 | ||
| {{فرز تاريخ|year|month|day}} | {{فرز تاريخ|2024|يونيو|12}}
|
12 يونيو 2024 | |
{{فرز تاريخ|-204|11|22}}
|
22 نوفمبر 204 ق.م | ||
| {{فرز تاريخ|year|month|day|era}} | {{فرز تاريخ|44|3|15|BC}}
|
15 مارس 44 ق.م | |
{{فرز تاريخ|94|Oct|17|AD}}
|
17 أكتوبر 94 | ||
| {{فرز تاريخ|month}} | {{فرز تاريخ||May}}
|
مايو | |
| {{فرز تاريخ|month|day}} | {{فرز تاريخ||Sep|12}}
|
12 سبتمبر |
Formatting
[عدل]Using a format in the |format= parameter, such as dmy, produces a format that depends on, but is not necessarily equal to the format of the supplied date. The |format= parameter can take nine values.
| value | function | input code | hidden sort key | visible output |
|---|---|---|---|---|
| format depends on the input | {{فرز تاريخ|26 Jan 1788}}
|
26 يناير 1788 | ||
{{فرز تاريخ|March 12, 1557}}
|
مارس 12, 1557 | |||
{{فرز تاريخ|1975-02-13}}
|
13 فبراير 1975 | |||
dmy |
displays the date in day-month-year format | {{فرز تاريخ|Sep 13, 1888|format=dmy}}
|
13 سبتمبر 1888 | |
{{فرز تاريخ|1983-01-03|format=dmy}}
|
3 يناير 1983 | |||
dm |
displays only the day and month in day-month format | {{فرز تاريخ|Feb 26, 1788|format=dm}}
|
26 فبراير | |
{{فرز تاريخ|2020-10-15|format=dm}}
|
15 أكتوبر | |||
mdy |
displays the date in month-day-year format | {{فرز تاريخ|August 31, 1901|format=mdy}}
|
أغسطس 31, 1901 | |
{{فرز تاريخ|2006-11-08|format=mdy}}
|
نوفمبر 8, 2006 | |||
md |
displays only the day and month in month-day format | {{فرز تاريخ|26 Jun 1988|format=md}}
|
يونيو 26 | |
{{فرز تاريخ|2002-02-27|format=md}}
|
فبراير 27 | |||
my |
displays only the month and year in month-year format | {{فرز تاريخ|16 November 1488|format=my}}
|
نوفمبر 1488 | |
d |
displays only the day | {{فرز تاريخ|6 July 1666|format=d}}
|
6 | |
m |
displays only the month | {{فرز تاريخ|1980-02-12|format=m}}
|
فبراير | |
y |
displays only the year | {{فرز تاريخ|-26|Jan|18|format=y}}
|
26 ق.م | |
hide |
hides the date | {{فرز تاريخ|15 October 1800|format=hide}}
|
Abbreviation
[عدل]There are two ways of abbreviating the month name.
- Directly input an abbreviated month name.
- Use the
|abbr=onparameter. It can be placed before or after the date in the template. This allows one to abbreviate the month later if the table becomes too wide. It is easy to use find-and-replace in a text editor, or the wikitext editor, to replace{{فرز تاريخ|with{{فرز تاريخ|abbr=on|
| abbreviation method | input code | hidden sort key | visible output |
|---|---|---|---|
| none | {{فرز تاريخ|2000-01-01}}
|
1 يناير 2000 | |
{{فرز تاريخ|2000|1|1}}
|
1 يناير 2000 | ||
{{فرز تاريخ|1 January 2000}}
|
1 يناير 2000 | ||
{{فرز تاريخ|2000|January|1}}
|
1 يناير 2000 | ||
| abbreviated input | {{فرز تاريخ|1 Jan 2000}}
|
1 يناير 2000 | |
{{فرز تاريخ|2000|Jan|1}}
|
1 يناير 2000 | ||
abbr=on |
{{فرز تاريخ|1 January 2000|abbr=on}}
|
1 يناير 2000 | |
{{فرز تاريخ|2000|January|1|abbr=on}}
|
1 يناير 2000 | ||
{{فرز تاريخ|2000-01-01|abbr=on}}
|
1 يناير 2000 | ||
{{فرز تاريخ|2000|1|1|abbr=on}}
|
1 يناير 2000 |
Additional sort key
[عدل]In case two dates in a table are identical they may be ordered using the addkey parameter.
| input code | hidden sort key | visible output |
|---|---|---|
{{فرز تاريخ|2010-10-10|addkey=3}}
|
10 أكتوبر 2010 | |
{{فرز تاريخ|2010-10-09}}
|
9 أكتوبر 2010 | |
{{فرز تاريخ|2010-10-10|addkey=1}}
|
10 أكتوبر 2010 | |
{{فرز تاريخ|2010-10-10}}
|
10 أكتوبر 2010 | |
{{فرز تاريخ|2010-10-10|addkey=4}}
|
10 أكتوبر 2010 | |
{{فرز تاريخ|2010-10-11}}
|
11 أكتوبر 2010 | |
{{فرز تاريخ|2010-10-10|addkey=2}}
|
10 أكتوبر 2010 |
Wrapping
[عدل]Wrapping of the date can help narrow a column and table. To allow wrapping use the |nowrap=off parameter. For further narrowing use the |abbr=on parameter as described elsewhere. Both of these parameters help with wide tables, narrow screens, cell phones, etc..
TemplateData
[عدل]Date table sorting is used to correctly sort and display dates in a sortable table.
| وسيط | وصف | نوع | حالة | |
|---|---|---|---|---|
| Full date or year | 1 | Full date if second to fourth parameters are not specfied, otherwise year. Full date can be either in "YYYY-MM-DD", "DD-MM-YYYY", "DD Month YYYY", "Month DD, YYYY", "YYYY-MM", "DD Month", "Month DD", "Month YYYY" or "Month" format. Year is either a positive number or a negative number. If fourth parameter is not specified negative numbers are interpreted as years of BC era. Parameter is optional if the second parameter is specified.
| نص | مطلوب |
| Month | 2 | Full or abbreviated month name or alternatively, a month number which can be zero-padded. Parameter is optional if the third parameter is not specified.
| نص | اختياري |
| Day | 3 | Day, optionally zero-padded
| رقم | اختياري |
| Era | 4 | BC, AD, BCE or CE. Takes effect only if the first parameter is a positive number. | نص | اختياري |
| Format | format | Controls the output format. Can be "dmy", "dm", "mdy", "md", "my", "d", "m", "y" or "hide". | نص | اختياري |
| Abbreviation | abbr | Abbreviates the month name
| نص | اختياري |
| Additional sort key | addkey | Adds another sort key to resolve conflicts between rows with the same date
| رقم | اختياري |
| Wrapping | nowrap | To allow wrapping use the ''nowrap=off'' parameter.
| بولياني | اختياري |
Notes
[عدل]Sorting for incomplete dates
[عدل]- Whole months or years
- A whole year or month (and year) is sorted according to its first day.
- Missing years
- If the year is not specified, the date will be sorted as if the year were the current year.
- Blank dates
- For no date input at all, the maximum possible sort key is used, so the entry will sort last.
Error handling
[عدل]Errors are tracked in تصنيف:قوالب فرز تاريخ مع أخطاء.
Calendar choice
[عدل]The template is not capable of distinguishing Julian and Gregorian calendar dates. Also, it is not capable of taking a date in one calendar as input and outputting a date in the other calendar. Thus, to ensure proper sorting, editors must either use one calendar for all dates, or pick a specific changeover date (for example, deciding that 4 October 1582 is Julian and all later dates are Gregorian); this would be done on an article-by article basis. Editors are also responsible for explaining to the reader whether the visible dates are Julian or Gregorian, if there is any possibility of confusion.
Linking
[عدل]The template formerly linked dates automatically, with |link=off used to suppress linking. In accordance with current guidelines, linking of dates is no longer supported and instances of |link=off should be removed.
See also
[عدل]- {{sort}}, sorting by a specified key (also good for complicated numbers, e.g. scientific notation)
- {{sortname}}, full name sorting (using "last name, first name" as default sort key)
- {{tts}}, for sorting times in result tables of athletic events (only needed in certain cases - see template documentation)
- {{Number table sorting}}, for numbers
- {{Year in date-sorted table}}, to sort years in a column with
|data-sort-type=date