Do dates in documents have to be UTC for FTS to find them?

The FTS docs state “Full text search and Bleve expect dates to be in the format specified by RFC-3339”.

It isn’t specified if the dates need to be UTC or not (i.e. no time zone).

I have a FTS index on a single ‘datetime’ field.

I searched with “start”:“1968-05-11T04:00:00Z”,“end”:“1968-05-17T04:00:00Z”

It found a document containing “1968-05-14T04:00:00Z”,
It did not find a document “1968-05-14T00:00:00-0400”

Is that the correct behavior?

Thanks for your time!

Hey @jodum, you’re date range query should capture all documents that fall within the range specified by the query as long as the date is in the format specified by RFC-3339, which is a specific profile of ISO-8601 that is more restrictive (as mentioned here: https://developer.couchbase.com/documentation/server/current/fts/fts-query-types.html).

As seen on the wiki page for ISO-8601, the accepted formats are:

Combined date and time in UTC:
* 2017-12-19T17:38:43+00:00
* 2017-12-19T17:38:43Z
* 20171219T173843Z

So I’d expect a document with: “1968-05-14T00:00:00-04:00” to match but not “1968-05-14T00:00:00-0400”.

Adding the colon separator to the time zone data did the trick.

Thanks!

(I had encountered this issue before, but unfortunately had completely forgotten about it…)