2016-08-16

chg

← Older revision

Revision as of 20:02, 16 August 2016

Line 7:

Line 7:

The [[Help:Properties_and_types#Datatypes_for_properties|datatype]] '''Date''' is used for data values that represent points in time. It is able to support dates throughout human history in a unified format, and it offers internationalisation options for supporting more languages. All dates and times refer to the "local time" of the server (or the wiki). A wiki may define what timezone this refers to by common conventions. For export, times are given without timezone information. However, time offsets to that local time are supported.

The [[Help:Properties_and_types#Datatypes_for_properties|datatype]] '''Date''' is used for data values that represent points in time. It is able to support dates throughout human history in a unified format, and it offers internationalisation options for supporting more languages. All dates and times refer to the "local time" of the server (or the wiki). A wiki may define what timezone this refers to by common conventions. For export, times are given without timezone information. However, time offsets to that local time are supported.



Since [[Semantic MediaWiki
1.8.0|SMW
1.8.0]] dates are stored in a full serialised format, including the calendar model.

+

Since [[Semantic MediaWiki 1.8.0]] dates are stored in a full serialised format, including the calendar model.

== Display format ==

== Display format ==

Line 19:

Line 19:

=== LOCL ===

=== LOCL ===



See [[CiteRef::
github
:smw:1545]]

+

See [[CiteRef::
gh
:smw:1545]]

=== ISO ===

=== ISO ===

Line 118:

Line 118:

Instead of displaying the annotated date „6 November 1796 Jl“ with the output statement <code>?Geburtsdatum</code>, one may have this date displayed as „17 November 1796 Gr“ by using the output statement <code>?Geburtsdatum#GR</code>.

Instead of displaying the annotated date „6 November 1796 Jl“ with the output statement <code>?Geburtsdatum</code>, one may have this date displayed as „17 November 1796 Gr“ by using the output statement <code>?Geburtsdatum#GR</code>.



[[
SMW
2.4]] is to indicate the
CalendarModel
for a date if is not a Greogorian calendar date and <code>SMW_DV_TIMEV_CM</code>[[CiteRef::
github
:smw:1545]] can be used to disable this

[[Help:$smwgDVFeatures|option ]].

+

[[
Semantic MediaWiki
2.4
.0
]] is to indicate the
calendar model
for a date if is not a Greogorian calendar date and <code>SMW_DV_TIMEV_CM</code>[[CiteRef::
gh
:smw:1545]] can be used to disable this [[Help:$smwgDVFeatures|option]].

== Maximal date range ==

== Maximal date range ==

Line 125:

Line 125:

== Era information ==

== Era information ==



Display of era information for positive years
[[CiteRef::github:smw:1396]]
(if denoted) is supported starting with [[
SMW
2.4]].

+

Display of era information for positive years (if denoted) is supported starting with [[
Semantic MediaWiki
2.4
.0
]].
[[CiteRef::gh:smw:1396]]

=== BC, negative years, and the year 0 ===

=== BC, negative years, and the year 0 ===

Line 136:

Line 136:

== Sorting dates in tabular outputs ==

== Sorting dates in tabular outputs ==



The sortable table code of [[MediaWiki]] cannot handle dates. To make them sort properly, one needs to provide numeric sortkeys using the "data-sort-value" attribute in td elements (look at the HTML of any real SMW table for examples). To allow this to be done, the  new parameter "#SORTKEY" was added to this datatype by which one can obtain a numeric sortkey as needed for "data-sort-value". For example, the following query displays dates and their sortkeys:

+

The sortable table code of [[MediaWiki]] cannot handle dates. To make them sort properly, one needs to provide numeric sortkeys using the "data-sort-value" attribute in td elements (look at the HTML of any real SMW table for examples). To allow this to be done, the  new parameter "
<code>
#SORTKEY
</code>
" was added to this datatype by which one can obtain a numeric sortkey as needed for "data-sort-value". For example, the following query displays dates and their sortkeys:



<pre>{{#ask: [[Modification date::+]]

+

<pre>



| ?Modification date

+

{{#ask:



| ?Modification date#SORTKEY

+

[[Modification date::+]]



}}</pre>

+

|?Modification date

+

|?Modification date#SORTKEY

+

}}

+

</pre>



For properties that can have many values, only one
sortkey
must be used (since the whole table row is sorted as one, even if many dates are in one cell). This can be achieved by using parameter "+limit" like in this example:

+

For properties that can have many values, only one
"<code>#SORTKEY</code>"
must be used (since the whole table row is sorted as one, even if many dates are in one cell). This can be achieved by using parameter "
<code>
+limit
</code>
" like in this example:



+

<pre>



<pre>{{#ask: [[
testdate
::+]]

+

{{#ask:



| ?
testdate

+

[[
Testdate
::+]]



| ?
testdate
#SORTKEY |+limit=1

+

|?
Testdate



}}</pre>

+

|?
Testdate
#SORTKEY |+limit=1

+

}}

+

</pre>

== Handling of incomplete dates ==

== Handling of incomplete dates ==

Line 156:

Line 161:

== Technical notes ==

== Technical notes ==



See [[CiteRef::
github
:smw:1545]]

+

See [[CiteRef::
gh
:smw:1545]]



+

* <code>TimeValueFormatter::getCaptionFromDataItem</code> uses the content language which is either the default [[content language]] or if available the [[page content language]]

* <code>TimeValueFormatter::getCaptionFromDataItem</code> uses the content language which is either the default [[content language]] or if available the [[page content language]]

* <code>ExtraneousLanguage::getPreferredDateFormatByPrecision</code> determines a PHP DateTime format string as preference for a specific language in combination with a precision

* <code>ExtraneousLanguage::getPreferredDateFormatByPrecision</code> determines a PHP DateTime format string as preference for a specific language in combination with a precision

Line 166:

Line 170:

* Internationalisation is incomplete: "BC", "AD", "PM", "AM" are fixed for all languages.

* Internationalisation is incomplete: "BC", "AD", "PM", "AM" are fixed for all languages.

* Conversion between (historic) calendar models is not supported yet.

* Conversion between (historic) calendar models is not supported yet.



+

<div style="display: none">



{{#scite:
github
:smw:1389

+

{{#scite:
gh
:smw:1389

|type=issue

|type=issue



|citation text=[https://github.com/SemanticMediaWiki/SemanticMediaWiki/pull/1389
free
date/time formatting support]

+

|citation text=[https://github.com/SemanticMediaWiki/SemanticMediaWiki/pull/1389
Semantic MediaWiki: GitHub pull request 1389 - Free
date/time formatting support]



}}{{#scite:
github
:smw:
1396

+

}}

+

{{#scite:
gh
:smw:
1397

|type=issue

|type=issue



|citation text=[https://github.com/SemanticMediaWiki/SemanticMediaWiki/pull/
1396 #1396] Indicate AC/CE era for positive years if it was explicitly annotated
]

+

|citation text=[https://github.com/SemanticMediaWiki/SemanticMediaWiki/pull/
1397 Semantic MediaWiki: GitHub pull request 1397
]



}}{{#scite:
github
:smw:
1545

+

}}

+

{{#scite:
gh
:smw:
1396

|type=issue

|type=issue



|citation text=[https://github.com/SemanticMediaWiki/SemanticMediaWiki/pull/1396
#LOCL as TimeValue output format
]

+

|citation text=[https://github.com/SemanticMediaWiki/SemanticMediaWiki/pull/1396
Semantic MediaWiki: GitHub pull request 1396 - Indicate AC/CE era for positive years if it was explicitly annotated
]



}}{{#scite:
github
:smw:
1397

+

}}

+

{{#scite:
gh
:smw:
1545

|type=issue

|type=issue



|citation text=[https://github.com/SemanticMediaWiki/SemanticMediaWiki/pull/
1397
#
1397
]

+

|citation text=[https://github.com/SemanticMediaWiki/SemanticMediaWiki/pull/
1545 Semantic MediaWiki: GitHub pull request 1545 - <code>
#
LOCL</code> as TimeValue output format
]

}}

}}

+

</div>

{{DEFAULTSORTKEY:Date}}

{{DEFAULTSORTKEY:Date}}

{{docinfo

{{docinfo

Show more