[CLOSED] timefield editor default date

  1. #1

    [CLOSED] timefield editor default date

    I'm having problem with timefield editor in datecolumn. I have two datecolumn with timefield editor, "StartTime" and "EndTime"

    The first time it's loaded, the StartTime show "19:00" which it got from database which it's real value is "1900-01-01 19:00". If I choose another StartTime, for example "20:00" the value I got is "1900-01-01 20:00".

    And then when I select an EndTime from the dropdown timefield editor, from code behind, this is the value I got "2008-01-01 20:30". The EndTime timefield editor use date "2008-01-01" as it's default date value.

    So when I want to get the time difference between 19:00 to 20:30, I can't get the right value, because it also take into count the date difference. My question is how to set the day-month-year of timefield to always refer to the same default value, in this case to "1900-01-01"?

    This is my code and screenshots




    <ext:GridPanel ID="GridPanel2" runat="server" fittoframe="true" AutoScroll="True" MaxHeight="250">
           <Store>
                <ext:Store ID="STR1"  runat="server">
                <Model>
                    <ext:Model runat="server" ID="Model1">
                        <Fields>
                            <ext:ModelField Name="StartTime" Type="Date" />
                            <ext:ModelField Name="EndTime" Type="Date" />
                        </Fields>
                    </ext:Model>
                </Model>
                </ext:Store>
            </Store>
           <ColumnModel ID="ColumnModel2" runat="server" DefaultSortable="false">
            <Columns><ext:DateColumn ID="Column1" runat="server" Text="Start Time" DataIndex="StartTime" Width="100" Format="H:i">
                    <Editor>
                        <ext:TimeField  ID="edStartTime" runat="server" Format="H:i"/>
                    </Editor>
                </ext:DateColumn>
                <ext:DateColumn ID="Column2" runat="server" Text="Time End" DataIndex="EndTime" Width="100" Format="H:i">
                    <Editor>
                        <ext:TimeField  ID="edEndTime" runat="server" Format="H:i"/>
                    </Editor>
                </ext:DateColumn>
            </Columns>
        </ColumnModel>                                                         
    </ext:GridPanel>
    Attached Thumbnails Click image for larger version. 

Name:	11.png 
Views:	31 
Size:	2.2 KB 
ID:	14601   Click image for larger version. 

Name:	22.png 
Views:	32 
Size:	6.2 KB 
ID:	14611  
    Last edited by Daniil; Sep 02, 2014 at 1:07 PM. Reason: [CLOSED]
  2. #2
    Hi @redi,

    My question is how to set the day-month-year of timefield to always refer to the same default value, in this case to "1900-01-01"?
    I think it might be problematic to do.

    I would recommend to set the same date for both the values when you need to get the difference between them.
  3. #3
    I think I'm having the same problem. Where is that date 2008-01-01 come from?
  4. #4
  5. #5
    How can we change the default date?
  6. #6
    You can put this JavaScript code into the page's <head> head.
    Ext.picker.Time.prototype.initDate = [1900, 0, 1];

Similar Threads

  1. [CLOSED] Set Default Value to DateField Editor in GridPanel
    By hemantpatil in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Feb 18, 2013, 11:34 AM
  2. [CLOSED] Default date format for Type="Date" RecordField
    By r_honey in forum 1.x Legacy Premium Help
    Replies: 12
    Last Post: May 29, 2012, 3:16 PM
  3. Default value for date type variable
    By emon in forum 1.x Help
    Replies: 10
    Last Post: Mar 10, 2011, 9:35 AM
  4. Replies: 13
    Last Post: Sep 06, 2010, 7:51 PM
  5. How to set timefield default blank?
    By isqueenie in forum Open Discussions
    Replies: 0
    Last Post: Sep 09, 2009, 11:26 PM

Tags for this Thread

Posting Permissions