Announcement

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

    Date Picker: Invalid range issues

    Be sure your post includes:

    1. SmartClient Version: v9.1p_2014-07-20/Pro Deployment (built 2014-07-20)

    2. FireFox v31.0, Chrome Version 36.0.1985.125 m

    3. sample code

    I have listgrid as follows

    Code:
    isc.ListGrid.create({
                dataSource: "showcase_ListInfo",
                autoFetchData: true,
                showFilterEditor: true
            })
    For the datasource

    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    
    <DataSource ID="showcase_ListInfo"
                titleField="displayedName"
                clientOnly="true"
                dataFormat="json"
                dataURL="/<project_name_goes_here>/ds/test_data/showcase_ListInfo.data.json"
        >
        <fields>
            <field name="dateTime" width="150" type="datetime" title="Date Time"/>
            <field name="number" type="integer" title="Number">
                <validators>
                    <validator errorMessage="Invalid Numeric Value" type="isInteger"/>
                </validators>
            </field>
         </fields>
    </DataSource>
    Here is the small snippet for showcase_ListInfo.data.json -
    Code:
    [
      {"dateTime":"2009-04-24T06:07:20-04:00",
            "number":10}
    {"dateTime":"2009-05-24T06:07:20-04:00",
            "number":10}
    {"dateTime":"2009-05-24T06:07:20-04:00",
            "number":12}
    {"dateTime":"2009-04-24T06:07:15-04:00",
            "number":10}
    {"dateTime":"2009-04-24T06:07:16-04:00",
            "number":12}
    {"dateTime":"2009-06-24T06:07:20-04:00",
            "number":10}
    {"dateTime":"2009-04-24T06:07:20-04:00",
            "number":10}
    {"dateTime":"2009-05-24T06:07:20-04:00",
            "number":10}
    {"dateTime":"2009-05-24T06:07:20-04:00",
            "number":12}
    {"dateTime":"2009-04-24T06:07:15-04:00",
            "number":10}
    {"dateTime":"2009-04-24T06:07:20-04:00",
            "number":10}
    {"dateTime":"2009-05-24T06:07:20-04:00",
            "number":10}
    {"dateTime":"2009-05-24T06:07:20-04:00",
            "number":12}
    ]
    Now there are 2 issues here -

    FIRST -
    1. Open the date range dialog
    2. In the "To:" field add date earlier than "From:" field
    3. Click Ok - As expected the error "To Field value cannot be earlier than From field value" error is shown.
    4. Close the dialog and open it again to find the error bubble still persisting.

    SECOND -
    Perform all the steps from 1-3.
    4. Now change the millisecond in "To" field some value like "999" and hit Ok.
    5. Notice that the value in the "To" field is change to some random time.

    Can you tell me if I am going wrong some where?

    - Thanks

    #2
    Your point 1) was a bug which has now been fixed for builds dated August 14 and later.

    On your point 2) - you can't edit milliseconds in this way by default - they would not be recognized as valid dates. So, you must have formatters and parsers installed, right?

    We'll need to see the code for those too in order to help with that - please also describe an exact test for this (an exact test value to enter, the exact value to change it to and the exact value it produces).

    Comment


      #3
      Formatters Installed

      Apologies for delayed response but here is the formatters installed -
      Code:
        isc.Time.setNormalDisplayFormat("to24HourTime");
              isc.Time.setShortDisplayFormat("to24HourTime");
              isc.Date.setShortDatetimeDisplayFormat("toString");
              isc.Date.setShortDisplayFormat("toSerializeableDate");
              isc.Date.setNormalDisplayFormat("toString");
              isc.Date.setInputFormat("YMD");

      Reproduction Scenario -

      1. Make a listgrid with a datetime field in it.
      2. Make sure to have the above formatters installed.
      3. YOu can use the above dummy data.
      4. Open the date range dialog.
      5. Get any date (I used the current date) - make sure both dates are equal.
      6. Type in a millisecond field in the "To" field and press OK

      Observation -
      It returns with "Invalid Date Range" icon but at the same time changes the time by timezone (in out case -4).

      Thanks
      Last edited by shresthg_des; 5th Sep 2014, 07:28. Reason: adding more information

      Comment


        #4
        We're not sure what you're trying to achieve with these settings, but in our testing, it isn't possible to save *any* date value with the formatters you have installed - the problem is that you have no parser for those various different formats you're specifying.

        Your inputFormat is "YMD", which implies a value formatted like YYYY/MM/DD - but your formatter is "toString", which produces a value like "Fri Sep 12 2014 ..."

        Take a look at the docs for setInputFormat() - you want to pass in a function that knows how to parse whatever format you expect items to be displaying.

        You may want to also customize your date-formats, as well as the parser - you can do that by passing format strings or formatting function in your calls to Date.setShortDatetimeFormat(), et al, rather than using builtins like "toString".

        Note also that these formats still don't allow you to edit milliseconds, so we don't understand your comment about updating the millisecond value - let us know if we're missing something.

        Comment

        Working...
        X