Skip to content

Commit

Permalink
Provide arity-1 variant using default place
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelhkay committed Nov 2, 2024
1 parent 564c1e5 commit 1274d06
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
16 changes: 14 additions & 2 deletions specifications/xpath-functions-40/src/function-catalog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10698,10 +10698,15 @@ return ($value - unix-dateTime()) div seconds(0.001)</eg>
<fos:signatures>
<fos:proto name="civil-timezone" return-type="xs:dayTimeduration">
<fos:arg name="dateTime" type="xs:dateTime"/>
<fos:arg name="place" type="xs:string"/>
<fos:arg name="place" type="xs:string" default="()"/>
</fos:proto>
</fos:signatures>
<fos:properties>
<fos:properties arity="1">
<fos:property>deterministic</fos:property>
<fos:property dependency="default-place">context-dependent</fos:property>
<fos:property>focus-independent</fos:property>
</fos:properties>
<fos:properties arity="2">
<fos:property>deterministic</fos:property>
<fos:property>context-independent</fos:property>
<fos:property>focus-independent</fos:property>
Expand All @@ -10713,6 +10718,8 @@ return ($value - unix-dateTime()) div seconds(0.001)</eg>
<p>This function uses a database of civil timezones (including daylight savings time) to return
the timezone offset for a given date/time and place. For example, the timezone offset for New York
on 31 December 2024 would be <code>-PT5H</code>.</p>
<p>If the <code>$place</code> argument is omitted or empty then the <xtermref spec="XP40" ref="dt-default-place"/>
from the dynamic context.</p>
<p>If the supplied <code>$dateTime</code> has no timezone then the implicit timezone from the dynamic
context is used. This is unrelated to the timezone applicable to the requested <code>$place</code>.</p>
<p>The intended use of the <code>$place</code> argument is to identify
Expand Down Expand Up @@ -10754,6 +10761,11 @@ represented by the <code>$dateTime</code> argument took place or will take place
)</eg>
<p>returns the current civil date and time in New York.</p>
</fos:example>
<fos:example>
<p>If the default place is a location in the same timezone as (say) Paris, then the expression</p>
<eg>civil-timezone('2024-07-01T09:00:00')</eg>
<p>returns PT2H.</p>
</fos:example>
</fos:examples>
<fos:changes>
<fos:change issue="1539"><p>New in 4.0</p></fos:change>
Expand Down
7 changes: 5 additions & 2 deletions specifications/xquery-40/src/expressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1559,12 +1559,15 @@ comparison or arithmetic operation. The implicit timezone is an <termref
<termdef id="dt-default-place" term="default place">
<term>Default place.</term>
This is a geographical location used to identify the place where events happened (or will happen) when
formatting dates and times using functions such as <code>fn:format-date</code> and <code>fn:format-dateTime</code>,
processing dates and times using functions such as <code>fn:format-date</code>, <code>fn:format-dateTime</code>,
and <code>fn:civil-timezone</code>,
if no other place is specified. It is used when translating timezone offsets to civil timezone names,
and when using calendars where the translation from ISO dates/times to a local representation is dependent
on geographical location. Possible representations of this information are an ISO country code or an
Olson timezone name, but implementations are free to use other representations from which the above
information can be derived.</termdef>
information can be derived. The only requirement is that it should uniquely identify a civil timezone,
which means that country codes for countries with multiple timezones, such as the United States,
are inadequate.</termdef>
</p>
</item>

Expand Down

0 comments on commit 1274d06

Please sign in to comment.