Announcement

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

    Probably bug in DateRangeItem

    Hi,

    Using SmartClient Version: v8.3p_2012-12-28/LGPL Development Only (built 2012-12-28) with Firefox 16.0.
    I have the following problem:

    1. Please visit the showcase
    http://www.smartclient.com/smartgwt/showcase/#grid_daterange_filtering

    2. As FROM select something through calendar component.

    3. As TO select one of the choices from dropdown list (Today,Yesterday,Tomorrow etc.)

    4. To server are criteria sent as:
    Code:
           criteria:[
                {
                    fieldName:"independence", 
                    operator:"greaterOrEqual", 
                    value:"[b]2013-01-09[/b]"          -> [i]without the time part[/i]
                }, 
                {
                    fieldName:"independence", 
                    operator:"lessOrEqual", 
                    value:"[b]2013-01-10T16:04:13[/b]" -> [i]with the time part[/i]
                }
            ]
    Is this a bug? If yes, when can be fixed ?

    #2
    There are a couple of things going on here:
    1) There is a logic bug that handles automatically converting "relative" dates to absolute dates (see DataSource.autoConvertRelativeDates) which is causing criteria for a field of type "date" to be converted into a datetime rather than a date when sent to the server. We have a fix for this which will be present in the next nightly build (4.0d and 3.1p branches).

    2) Also, in that sample the dateRangeItem does not have a data type explicitly set to either "date" or "datetime", and the form is not bound to the same dataSource as the grid being filtered. As a result there is some ambiguity about whether values selected should be displayed as a datetime or a date. This should be handled better in the framework and we will work on improving the default behavior in this scenario to be more consistent, but within your application you should be able to avoid this by explicitly setting the data type of the field in the filter-form.

    ---
    Update: We have now made a change to address both of these issues in the framework. But it is still a good idea to explicitly specify the data type for the DateRangeItem in this kind of usage to ensure you don't have UI allowing the user to pick a date + time, for a dataSource field that is of type "date" rather than "datetime".
    Last edited by Isomorphic; 9 Jan 2013, 12:05.

    Comment


      #3
      Thank you for your explanation. I have another question: is it is possible to have a date item (so the user will see only the date part in textfield, after selection through calendar or will see relative option by selecting something from dropdown) but to server will be sent date+time ?
      Last edited by geletkaf; 9 Jan 2013, 15:01.

      Comment


        #4
        If you haven't already, take a look at the date format and storage documentation. This discusses the difference between Date and Datetime type fields in a DataSource.

        To answer your specific question - it would be possible to have a DateItem which doesn't display the time component to the user, but have a server request (a filter or a save) save a datetime value (a JavaScript date with a meaningful time portion).
        However the right way to accomplish this within your application might well depend on your usage. For example - in a dateItem with no time shown, the user will not be able to edit the time portion, and indeed it will be a somewhat arbitrary value, and possibly not what you want passed to your server. You could handle this by having some custom logic to save the form which would get the values (including the date field value), modify the date by applying an appropriate time (using combineLogicalDateAndTime) and save the result.

        If you would like more help figuring out the right approach for you, we'd probably need to have a clear picture of what you are trying to achieve within your application.

        Comment


          #5
          Thank you again for your hints. My use case is following:

          I have a RelativeDateItem with FieldType as DATE, because i want to show to user just a date part (for example 01/02/2013).
          But, because i need to consider time zones i need to sent this item in criteria in the following format 2013-01-01T14:00:00 (if we are talking about RelativeDateRangePosition.START and UTC+10 time zone). Is this possible to achieve?

          ----
          Update:
          The solution i have found is working with setDateFormatter on the component level. Is there a better way ?
          Last edited by geletkaf; 10 Jan 2013, 04:18.

          Comment


            #6
            Using the dateFormatter to show the user just the date (and not the time) is probably the correct approach here, yes.

            Let us know if you need further assistance with it

            Regards
            Isomorphic Software

            Comment


              #7
              Hi again,

              the approach with setting the setDateFormatter is working well, but not for one case.

              When you choose "Today" from relative options, it is working well. But when you choose today through datepicker, it is sending to server value which is missing 23h59min and 59sec. It seems like when you work with relative options it is working with setRangePosition(RelativeDateRangePosition.END) (which is ok, because i did set it to this value) but for absolut options with setRangePosition(RelativeDateRangePosition.START).

              I also modified class GridDateRangeFilterSample from one of your showcase to demonstrate this behaviour.
              I was testing with SmartClient Version: v8.3p_2012-12-17/LGPL Development Only (built 2012-12-17).

              To me, it seems like a bug. Am i right? If yes, when can be fixed?

              Thank you.
              Attached Files
              Last edited by geletkaf; 11 Jan 2013, 11:40.

              Comment


                #8
                Any news on this issue?

                Comment


                  #9
                  This is assigned to one of our developers for investigation. We'll follow up when we have more information for you

                  Regards
                  Isomorphic Software

                  Comment


                    #10
                    A quick follow up here to reassure you that this is not forgotten. We have a solution in place undergoing some internal testing. We expect this to make it into nightly builds in the next couple of days

                    Regards
                    Isomorphic Software

                    Comment


                      #11
                      Thank you for update. Just let me know then please which version (nightly build).

                      Comment


                        #12
                        We have now made a change to address this in the 3.1p (and the SmartClient 8.3p) branch.
                        The change should be present in the next nightly build (Jan 23 or greater).

                        We will also be fixing this in the ongoing development branch (4.0d / 9.0d) shortly. There are some additional things to consider in that branch, so the fix there will be implemented differently but we anticipate the change going in there some time over the next few days.

                        Regards
                        Isomorphic Software

                        Comment


                          #13
                          Confirmed. This issue was solved.
                          Tested with SmartClient Version: v8.3p_2013-01-24/LGPL Development Only (built 2013-01-24).
                          Thank you.

                          Comment


                            #14
                            Hi.

                            We found a problem with DateRangeItem which is occuring only in IE.
                            Please, see the attached class GridDateRangeFilterSample from one of your showcases.
                            If you select some relative option from dropdown list, it is working as excepted (considering timezone in request criteria).
                            But if you select date through datepicker icon or write it there manually it is sending wrong time part.
                            For example: for UTC+1 is sending YYYY-MM-DDT11:00:00 (for both From and To) but it should send YYYY-MM-DDT23:00:00 for RelativeDateRangePosition.START and YYYY-MM-DDT22:59:59 for RelativeDateRangePosition.END.

                            Is this a bug? If yes, when can be fixed ?
                            Thank you.

                            Tested with SmartClient Version: v8.3p_2013-01-24/LGPL Development Only (built 2013-01-24) and IE9.
                            Attached Files
                            Last edited by geletkaf; 4 Mar 2013, 02:44.

                            Comment


                              #15
                              Hi again,

                              tested it again with SmartClient Version: v8.3p_2013-03-04/LGPL Development Only (built 2013-03-04). Still the same problem.

                              Regards,
                              Fero

                              Comment

                              Working...
                              X