Announcement

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

    Json

    Smartgwtpro 3.1p

    I have a ListGrid with datasource containing a DateTimeField, following is a snippet

    Code:
            DataSource dataSource = new DataSource();  
            dataSource.setDataFormat(DSDataFormat.JSON);  
    ...
    
            DataSourceDateTimeField dateTimefield = new DataSourceDateTimeField("dateTime", "Date/Time");
    The incoming data for 'dateTime' is in the format 'YYYY-MM-DDThh:mm:ssZ' where Z is + or - followed by a time expression hh:mm to indicate timezone.

    But the listgrid is always treating it as UTC. How can I have the datasource translate timezone info? Thanks.

    #2
    This should be supported and works in our tests.
    The date format and storage special javadoc topic describes how things should work.

    Can you show us how to reproduce the problem. Should be easy to do by creating a simple entryPoint class that defines your JSON dataSource with a datetime field, and fetches against (For example using a databound ListGrid), and showing us the JSON response text you're serving up.

    Thanks
    Isomorphic Software

    Comment


      #3
      Test case is attached. The data is from a JS file in this example, capture as follow:
      Code:
      [
          {
              status:"Auto",
              dateTime:"2012-12-31T12:00:00+5:30"
          },
          {
              status:"Auto",
              dateTime:"2012-12-31T13:01:00+5:30"
          },
          {
              status:"Pending",
              dateTime:"2012-12-31T14:02:01+5:30"
          }
      ]
      The screenshot is running on a browser at a timezone of UTC-5:00 (EST). I expect to see 10.5 hours before the stated time, e.g.
      2012-12-31 01:30:00
      2012-12-31 02:31:00
      2012-12-31 03:32:00
      Attached Files

      Comment


        #4
        Aha - we're failing to recognize the timezone specification as the system is expecting +/-HH:MM format and missing the case where the hour isn't two digits.

        If you change the JSON response to specify the timezone as +05:30, things should behave as expected.

        We'll also make a change (in the 4.0d branch) to ensure this isn't required in the future

        Regards
        Isomorphic Software

        Comment


          #5
          That works, thank you.

          Comment

          Working...
          X