Uploaded image for project: 'CMS'
  1. CMS
  2. CMS-9068

When building a DateQuery, the time precision is lost

XMLWordPrintable

      I don't know why but in org.ametys.cms.search.ui.model.impl.IndexingFieldSearchUICriterion.getDateQuery(Object, String, Operator)
      we do

      Date dateValue = (Date) ParameterHelper.castValue((String) value, ParameterType.DATE);
                  
      GregorianCalendar calendar = new GregorianCalendar();
      calendar.setTime(dateValue);
      calendar.set(Calendar.HOUR, 0);
      calendar.set(Calendar.MINUTE, 0);
      calendar.set(Calendar.MILLISECOND, 0);
      

      As a result if I call IndexingFieldSearchUICriterion.getQuery("2018-03-06T14:42:42Z", ...), it returns the query start_dt:"2018-03-06T12:00:42.000Z"

      So we lost hours, minutes and milliseconds precision !

            Unassigned Unassigned
            sprieul Simon Prieul (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: