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

When building a DateQuery, the time precision is lost

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • 4.8.13, 4.9.0
    • 4.1.0
    • Plugin : Search

      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 !

          [CMS-9068] When building a DateQuery, the time precision is lost

          With CMS-9610, this part of code will disappear (we passed to java.time through AdaptableDate)

          But this ticket remains, for the introduction of a DateTimeQuery

           

          Simon Prieul (Inactive) added a comment - With CMS-9610 , this part of code will disappear (we passed to java.time through AdaptableDate) But this ticket remains, for the introduction of a DateTimeQuery  

          Raphaël Franchet added a comment - - edited

          but not the second????!!!!

          why not: this is usefull to compare news for example.
          Maybe, we should add another getDateTimeQuery ?

          TBD

          Raphaël Franchet added a comment - - edited but not the second????!!!! why not: this is usefull to compare news for example. Maybe, we should add another getDateTimeQuery ? TBD

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

              Created:
              Updated: