[OPEN] [#79] date picker bug with format yyyy/W when select 2012/12/31

Page 1 of 2 12 LastLast
  1. #1

    [OPEN] [#79] date picker bug with format yyyy/W when select 2012/12/31

    case:
    Choose 31/12/2012

    Result:
    2012/01

    expected result.
    2013/01
    Last edited by Daniil; Dec 18, 2012 at 4:00 PM. Reason: [OPEN] [#79]
  2. #2
    Hello!

    Thank you for your report! We are investigating.

    Example to reproduce for Ext.NET 2.x and 1.x:

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            
            <ext:DateField runat="server" Format="yyyy/W" ID="DatePicker"></ext:DateField>
        </form>
    </body>
    </html>
    Steps:
    1) Choose December 31, 2012.
    2) Instead of 2012/1 should be 2013/1
    Last edited by Baidaly; Dec 18, 2012 at 1:51 AM.
  3. #3
    Quote Originally Posted by Baidaly View Post
    Hello!

    Can you say what version of Ext.NET are you using?
    --------------------------- 
    1.6                                                                       
  4. #4
    Quote Originally Posted by Baidaly View Post
    Hello!

    Thank you for your report! We are investigating.

    Example to reproduce for Ext.NET 2.x and 1.x:

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            
            <ext:DateField runat="server" Format="yyyy/W" ID="DatePicker"></ext:DateField>
        </form>
    </body>
    </html>
    Steps:
    1) Choose December 31, 2012.
    2) Instead of 2012/1 should be 2013/1

    Another problem, if using "yyyy/W" as format, after I run out of focus of the date picker, the value will become current week.
  5. #5
    Quote Originally Posted by qdano View Post
    case:
    Choose 31/12/2012

    Result:
    2012/01

    expected result.
    2013/01
    Hi,

    I doubt there should be "2013/01" for 31 December. We would expect "2012/53".

    Well, we would expect "2012/53".

    I reported it to Sencha.
    http://www.sencha.com/forum/showthread.php?251874

    Quote Originally Posted by qdano View Post
    Another problem, if using "yyyy/W" as format, after I run out of focus of the date picker, the value will become current week.
    I am unable to reproduce. Could you clarify exact steps?
  6. #6
    Dear Danill
    Thank you so much for your help and here is my dirty fix to add the following to the onselect event.

    fixlastweekno = function(menu, _dt) {
        var dt = new Date(_dt)
        week = dt.getWeek();
        year = _dt.getFullYear()
        //alert((new Date(menu)).getDay());
        if ((new Date(menu.value).getDate() * 1 >= 30) && (week == 52)) {
            val = '01/01/' + (year * 1 + 1);
    
            menu.setValue(new Date(val));
            /* menu.startValue = new Date();*/
            return 0;
        }
    
    }
    Secondly. I am working for a german company and our business rule sees the week after 52 as the 1st week of next year.
    Last edited by geoffrey.mcgill; Dec 18, 2012 at 9:37 AM. Reason: please use [CODE] tags
  7. #7
    Quote Originally Posted by qdano View Post
    Dear Danill
    Thank you so much for your help and here is my dirty fix to add the following to the onselect event.

    fixlastweekno = function(menu, _dt) {
        var dt = new Date(_dt)
        week = dt.getWeek();
        year = _dt.getFullYear()
        //alert((new Date(menu)).getDay());
        if ((new Date(menu.value).getDate() * 1 >= 30) && (week == 52)) {
            val = '01/01/' + (year * 1 + 1);
    
            menu.setValue(new Date(val));
            /* menu.startValue = new Date();*/
            return 0;
        }
    
    }
    Looks good. Thank you for sharing!

    Quote Originally Posted by qdano View Post
    Secondly. I am working for a german company and our business rule sees the week after 52 as the 1st week of next year.
    Interesting, I didn't know such an aspect. I added
    A German would expect 2013/01
    in the bug report. Hopefully, they will take it into account.
    Last edited by Daniil; Dec 18, 2012 at 11:08 AM.
  8. #8
    Sencha opened a bug ticket.

    Created an Issue to track this defect, see:
    https://github.com/extnet/Ext.NET/issues/79
  9. #9
    Dear Danill.
    Please let me provide a sample code that re-produce the second problem of "yyyy/W"

    here is my simple stupid code:

        <ext:DateField ID="dp" runat="server"  SelectOnFocus =true  Format ="yyyy/W"  start
                                    Width="200" EnableKeyEvents="false" Editable ="false"    >
                                  
                                
                                </ext:DateField>
    Test case, choose 5th Dec 2012

    Expected result
    2012/49

    Actual result:
    After choose 05/12/2012, the datefield correctly shows 2012/49,
    But after run out of focus(onblur event?) the datefield's value is 2012/51, which is currently week.

    I will post on the bug log and Thank you so much for your help and looking forward for fixing result.

    Best Regards
  10. #10
    Quote Originally Posted by qdano View Post
    Dear Danill.
    Please let me provide a sample code that re-produce the second problem of "yyyy/W"

    here is my simple stupid code:

        <ext:DateField ID="dp" runat="server"  SelectOnFocus =true  Format ="yyyy/W"  start
                                    Width="200" EnableKeyEvents="false" Editable ="false"    >
                                  
                                
                                </ext:DateField>
    Test case, choose 5th Dec 2012 , by clicking the text box of the datefield

    Expected result
    2012/49

    Actual result:
    After choose 05/12/2012, the datefield correctly shows 2012/49,
    But after run out of focus(onblur event?) the datefield's value is 2012/51, which is currently week.
    However, if I use the "trigger button" to choose date, It can give me correct result!


    I will post on the bug log and Thank you so much for your help and looking forward for fixing result.

    Best Regards
    I found another funny behavior!.
    if I pick a date by clicing the text box (EnableKeyEvents=false, editable=false) the returning value is current week.!

    If I pick a date by clicking the trigger button, the final value is correct!
    Last edited by qdano; Dec 19, 2012 at 5:21 AM.
Page 1 of 2 12 LastLast

Similar Threads

  1. Datefield with date 2012-10-21
    By rafabar in forum 1.x Help
    Replies: 0
    Last Post: Oct 23, 2012, 7:29 PM
  2. Replies: 3
    Last Post: May 09, 2012, 4:28 PM
  3. Replies: 1
    Last Post: Dec 15, 2011, 12:38 AM
  4. Replies: 3
    Last Post: May 06, 2010, 12:48 PM
  5. Replies: 8
    Last Post: Jun 06, 2008, 1:28 AM

Posting Permissions