Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    miliseconds in value for RelativeDateRangePosition.END DateTime item

    Hi Isomorphic,
    We have seen now that in the dsRequests dateTime has value formatted to display miliseconds.
    In our project we provide search mask with dateTime fields from and to.

    For this purpose we use com.smartgwt.client.widgets.form.fields.RelativeDateItem which is set to type FieldType.DATETIME.
    This is how we construct our items:
    Code:
            final RelativeDateItem fromRelativeDateItem = new RelativeDateItem("independenceFrom");
            fromRelativeDateItem.setOperator(OperatorId.GREATER_OR_EQUAL);
            fromRelativeDateItem.setRangePosition(RelativeDateRangePosition.START);
            fromRelativeDateItem.setType(FieldType.DATETIME.getValue());
    
            final RelativeDateItem toRelativeDateItem = new RelativeDateItem("independenceTo");
            toRelativeDateItem.setOperator(OperatorId.LESS_OR_EQUAL);
            toRelativeDateItem.setRangePosition(RelativeDateRangePosition.END);
            toRelativeDateItem.setType(FieldType.DATETIME.getValue());
    There are 3 possibilities to set the value to the item
    1. ​select relative value (e.g. yesterday)
    2. select date from the calendar
    3. type in the date
    For the case 1 we get following criteria (for the comparison there are also criteria for DateRangeItem)
    Code:
    {
        dataSource: "worldDS",
        operationType: "fetch",
        data: {
            operator: "and",
            criteria: [{
                operator: "and",
                criteria: [{
                    fieldName: "independence",
                    operator: "greaterOrEqual",
                    value: "2016-07-19T22:00:00.000"
                }, {
                    fieldName: "independence",
                    operator: "lessOrEqual",
                    value: "2016-07-22T21:59:59.999"
                }]
            }, {
                operator: "greaterOrEqual",
                value: "2016-07-19T22:00:00.000",
                fieldName: "independenceFrom"
            }, {
                operator: "lessOrEqual",
                value: "2016-07-22T21:59:59.999",
                fieldName: "independenceTo"
            }]
        }
    }
    For the case 2 and 3 we got slightly different criteria:
    Code:
    {
        dataSource: "worldDS",
        operationType: "fetch",
        data: {
            operator: "and",
            criteria: [{
                operator: "and",
                criteria: [{
                    fieldName: "independence",
                    operator: "greaterOrEqual",
                    value: "2016-07-19T22:00:00.000"
                }, {
                    fieldName: "independence",
                    operator: "lessOrEqual",
                    value: "2016-07-22T21:59:00.000"
                }]
            }, {
                operator: "greaterOrEqual",
                value: "2016-07-19T22:00:00.000",
                fieldName: "independenceFrom"
            }, {
                operator: "lessOrEqual",
                value: "2016-07-22T21:59:00.000",
                fieldName: "independenceTo"
            }]
        }
    }
    When the to item has RelativeDateRangePosition.END, shouldn't be for 2nd and 3rd case date value generated with 999 miliseconds?


    Attached modified showcase.
    Tested on Chrome and build SmartClient Version: v10.0p_2016-06-15/LGPL Development Only (built 2016-06-15)
    Attached Files
    Last edited by matus_b; 21 Jul 2016, 05:05. Reason: typo

    #2
    This has been fixed back to SmartGWT 5.0 - you can test the fix in builds dated July 23 and later.

    Comment


      #3
      It works, thank you

      Comment

      Working...
      X