Skip to content

Commit 0aabb4b

Browse files
chris-evolvedbinaryadamretter
authored andcommitted
[bugfix] Reverted "Change the return type of the current-dateTime function from datetime stamp to datetime"
1 parent d877da7 commit 0aabb4b

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

exist-core/src/main/java/org/exist/xquery/functions/fn/FunCurrentDateTime.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import org.exist.xquery.Profiler;
3333
import org.exist.xquery.XPathException;
3434
import org.exist.xquery.XQueryContext;
35-
import org.exist.xquery.value.DateTimeValue;
35+
import org.exist.xquery.value.DateTimeStampValue;
3636
import org.exist.xquery.value.FunctionReturnSequenceType;
3737
import org.exist.xquery.value.Item;
3838
import org.exist.xquery.value.Sequence;
@@ -48,11 +48,11 @@ public class FunCurrentDateTime extends Function {
4848
public final static FunctionSignature fnCurrentDateTime =
4949
new FunctionSignature(
5050
new QName("current-dateTime", Function.BUILTIN_FUNCTION_NS),
51-
"Returns the xs:dateTime (with timezone) that is current at some time " +
51+
"Returns the xs:dateTimeStamp (with timezone) that is current at some time " +
5252
"during the evaluation of a query or transformation in which " +
5353
"fn:current-dateTime() is executed.",
5454
null,
55-
new FunctionReturnSequenceType(Type.DATE_TIME,
55+
new FunctionReturnSequenceType(Type.DATE_TIME_STAMP,
5656
Cardinality.EXACTLY_ONE, "the date-time current " +
5757
"within query execution time span"));
5858

@@ -94,7 +94,7 @@ public Sequence eval(Sequence contextSequence, Item contextItem) throws XPathExc
9494
{context.getProfiler().message(this, Profiler.START_SEQUENCES,
9595
"CONTEXT ITEM", contextItem.toSequence());}
9696
}
97-
Sequence result = new DateTimeValue(this, context.getCalendar());
97+
Sequence result = new DateTimeStampValue(this, context.getCalendar());
9898
if (isCalledAs("current-dateTime")) {
9999
// do nothing, result already in right form
100100
} else if (isCalledAs("current-date")) {

exist-core/src/test/xquery/dates/convert-dates.xqm

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,26 @@ module namespace fd="http://exist-db.org/xquery/test/convert-dates";
2525

2626
declare namespace test="http://exist-db.org/xquery/xqsuite";
2727

28-
(: verify that we can convert xs:string to :xs:dateTime :)
28+
(: verify that we can convert xs:string to :xs:dateTimeStamp :)
2929
declare
3030
%test:args("2012-06-26T23:14:22.566+02:00")
3131
%test:assertEquals("11:14 pm on Tuesday, June 26th, 2012")
32-
function fd:format-dateTime($date as xs:dateTime) {
32+
function fd:format-dateTimeStamp($date as xs:dateTimeStamp) {
3333
format-dateTime($date, "[h00]:[m00] [P] on [FNn], [MNn] [D1o], [Y]", "en", (), ())
3434
};
3535

36-
(: verify that we can't convert xs:string without timezone to :xs:dateTime :)
36+
(: verify that we can't convert xs:string without timezone to :xs:dateTimeStamp :)
3737
declare
3838
%test:args("2012-06-26T23:14:22.566")
3939
%test:assertError
40-
function fd:convert-date-time($date as xs:dateTime) {
40+
function fd:convert-date-time-stamp($date as xs:dateTimeStamp) {
4141
format-dateTime($date, "[h00]:[m00] [P] on [FNn], [MNn] [D1o], [Y]", "en", (), ())
4242
};
4343

4444
declare
4545
%test:args("2022-05-17T16:24:06.003+02:00", "PT2H")
4646
%test:assertEquals("2022-05-17T18:24:06.003+02:00")
47-
function fd:add-test($date as xs:dateTime, $duration as xs:dayTimeDuration) {
47+
function fd:add-test($date as xs:dateTimeStamp, $duration as xs:dayTimeDuration) {
4848
$duration + $date
4949
};
5050

@@ -62,44 +62,44 @@ function fd:subtract-from-dateTime-test($date1 as xs:dateTime, $date2 as xs:date
6262
($date1 - $date2) cast as xs:string
6363
};
6464

65-
(: verify that fn:current-dateTime() return type is xs:dateTime :)
65+
(: verify that fn:current-dateTime() return type is xs:dateTimeStamp :)
6666
declare
6767
%test:assertEquals("true")
6868
function fd:current-dateTime-type() {
69-
fn:current-dateTime() instance of xs:dateTime
69+
fn:current-dateTime() instance of xs:dateTimeStamp
7070
};
7171

7272
declare
7373
%test:args("2022-05-17T16:24:06.003+02:00", "PT2H")
7474
%test:assertEquals("true")
75-
function fd:return-type-test($date as xs:dateTime, $duration as xs:dayTimeDuration) {
76-
($duration + $date) instance of xs:dateTime
75+
function fd:return-type-test($date as xs:dateTimeStamp, $duration as xs:dayTimeDuration) {
76+
($duration + $date) instance of xs:dateTimeStamp
7777
};
7878

7979
declare
80-
%test:args("not-a-dateTime")
80+
%test:args("not-a-dateTimeStamp")
8181
%test:assertError
82-
function fd:not-a-dateTime($date as xs:dateTime) {
83-
$date instance of xs:dateTime
82+
function fd:not-a-dateTimeStamp($date as xs:dateTimeStamp) {
83+
$date instance of xs:dateTimeStamp
8484
};
8585

8686
declare
8787
%test:args("2022-05-17T17:16:00.000")
8888
%test:assertError
89-
function fd:not-a-dateTime2($date as xs:dateTime) {
90-
$date instance of xs:dateTime
89+
function fd:not-a-dateTimeStamp2($date as xs:dateTimeStamp) {
90+
$date instance of xs:dateTimeStamp
9191
};
9292

9393
declare
9494
%test:args("2022-05-17T17:16:00.000Z")
9595
%test:assertEquals("true")
96-
function fd:create-dateTime($date as xs:dateTime) {
97-
$date instance of xs:dateTime
96+
function fd:create-dateTimeStamp($date as xs:dateTimeStamp) {
97+
$date instance of xs:dateTimeStamp
9898
};
9999

100100
declare
101101
%test:args("2022-05-17T17:16:00.000+01:00")
102102
%test:assertEquals("true")
103-
function fd:create-dateTime2($date as xs:dateTime) {
104-
$date instance of xs:dateTime
103+
function fd:create-dateTimeStamp2($date as xs:dateTimeStamp) {
104+
$date instance of xs:dateTimeStamp
105105
};

0 commit comments

Comments
 (0)