[CLOSED] Store Sync Date Problem

  1. #1

    [CLOSED] Store Sync Date Problem

    Hi,

    I'm trying to use sync api method of store but unfortunately when I deserialize the model in server-side, dates throws and exception because they are not received in ISO format, they are in UTC format.

    This is my store:
    <ext:Store ID="myStore" runat="server" PageSize="100" ShowWarningOnFailure="false" RemoteSort="false">
                            <Proxy>
                                <ext:AjaxProxy Url='<%# Url.Action("List") %>' AutoDataBind="true">
                                    <API Sync='<%# Url.Action("Save") %>' AutoDataBind="true" />
                                    <Reader>
                                        <ext:JsonReader IDProperty="ID" Root="data" TotalProperty="total" />
                                    </Reader>
                                    <Writer>
                                        <ext:JsonWriter Encode="true" Root="data" />
                                    </Writer>
                                </ext:AjaxProxy>
                            </Proxy>
                            <Model>
                                <ext:Model runat="server" IDProperty="ID">
                                    <Fields>
                                        <ext:ModelField Name="ID" Type="Int" />
                                        <ext:ModelField Name="Code" Type="String" />
                                        <ext:ModelField Name="Name" Type="String" />
                                        <ext:ModelField Name="StartDate" Type="Date" SortType="AsDate" />
                                        <ext:ModelField Name="EndDate" Type="Date" SortType="AsDate" />
                                        <ext:ModelField Name="Description" Type="String" />
                                        <ext:ModelField Name="State" Type="Int" SortType="AsInt" />
                                    </Fields>
                                </ext:Model>
                            </Model>
                        </ext:Store>
    The way I collect data is the following:
    var data = Ext.Net.JSON.Deserialize<List<MyModel>>(base.GetParam<string>("data"));
    And this is what I receive:
    [{"ID":20370,"Code":"379","Name":"Any Person Name","StartDate":"2011-05-07UTC00:00:00","EndDate":"2011-05-08UTC00:00:00","Description":"Extras Festivas","State":0}]
    And when it tries to deserialize crashes in JSONDateTimeJsonConverter.cs line number 106 in the method ReadJson:
    return DateTime.Parse(reader.Value.ToString(), CultureInfo.InvariantCulture);
    the message is
    The string was not recognized as a valid DateTime. There is an unknown word starting at index 10.
    Seems that it expects "2011-05-07T00:00:00" instead of "2011-05-07UTC00:00:00".

    Where I have to configure the store or model to send dates in iso format or configure deserialize to read utc dates?
    Last edited by Daniil; Sep 27, 2012 at 1:41 PM. Reason: [CLOSED]
  2. #2
    Hi @softmachine2011,

    It has been fixed yesterday. Please update from SVN or try to set
    DateFormat="yyyy-MM-dd\THH:ss:mm"
    for the date ModelField.
  3. #3
    Tested in rev 4377, works!

    Thanks
  4. #4
    Thank you for confirming!

Similar Threads

  1. [CLOSED] ComboBox didn't sync store's change
    By leon_tang in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Mar 12, 2012, 11:57 AM
  2. [CLOSED] Date FieldType Store problem
    By CarWise in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Sep 20, 2010, 5:36 PM
  3. sync callback
    By gisxiaowei in forum 1.x Help
    Replies: 0
    Last Post: Aug 20, 2009, 11:50 AM
  4. Replies: 0
    Last Post: Jul 07, 2009, 4:34 AM
  5. Examples - Community DLL in sync?
    By Tbaseflug in forum 1.x Help
    Replies: 0
    Last Post: Feb 17, 2009, 1:40 PM

Tags for this Thread

Posting Permissions