dateTime in Query

I am struggling with a query using DateTime type. Everything works fine using Date but if I test a DateTime input I get no match on my query.

I have (working example):
from content-type.xsml —> input name=“publishdate” type=“Date”*

var d = new Date();
var now = d.toISOString();

var query = "_parentPath = '/content/nibio/nyheter' AND data.publishdate < dateTime('" + now + "');
var result = execute('content.query', {
    start: start,
    count: count,
    sort: 'data.publishdate DESC',
    query: query,
    contentTypes: [ + ':article']

I want
from content-type.xsml —> input name=“publishdatetime” type=“DateTime”*


I want the same query as in the example above.

Hi. Is this in 5.x or 6.0 snapshot?

In either case, if you get no hits using datetime, maybe you are trying to query against a localDateTime-field? In 5.x to keep backward compatability, the default datetime input has no timezone, and is of type localDateTime. Then it is not possible to query against a value with timezone, since this make no sense (localDateTime is not a point on the timeline, while d.doISOString() gives a point on the timeline)

To enable the input to be of time LocalDateTime, add this config to your content-type definition:

<input name="myTrueDateTimeInput" type="DateTime">

With timezone will be default behavior for dateTime inputtypes in v6.0.0


It is in 5.x.

Thanks a lot. Fixed!