collective / collective.solr

Solr search engine integration for Plone
https://pypi.org/project/collective.solr/
22 stars 46 forks source link

Rounding error while formatting DateTime fields #230

Closed gforcada closed 4 years ago

gforcada commented 5 years ago

We are getting errors while trying to index objects to Solr due to the modified value sent to Solr being incorrectly formatted.

After digging through the code I pinned down the problem at https://github.com/collective/collective.solr/blob/master/src/collective/solr/indexer.py#L65 (when formatting a DateTime on function datehandler).

The input value is DateTime('2018/02/10 22:23:59.999907 GMT+1') which gets formatted to 2018-02-10T21:23:60.000Z, with an obvious invalid seconds value of 60.

I see that there are no unit tests for the datehandler method though :confused:

It feels incredible that the commit that introduced it, is more 12 years old and up until now nobody reported it :sweat_smile: