Results 1 to 10 of 10

Thread: Ext.Date.parse with 'W/Y' format buggy in ExtJS 4.2.1 for some years?

    Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-11231 in 4.2.3.
  1. #1
    Sencha User
    Join Date
    Sep 2013
    Posts
    14

    Default Ext.Date.parse with 'W/Y' format buggy in ExtJS 4.2.1 for some years?

    Test with ExtJS 4.2.1.883:
    Code:
    Ext.Date.getWeekOfYear(Ext.Date.parse('37/2013','W/Y')); // 37 -> OKAY
    Ext.Date.getWeekOfYear(Ext.Date.parse('37/2015','W/Y')); // 38 -> NOT OKAY
    
    
    Ext.Date.parse('37/2015','W/Y'); // Mon Sep 14 2015 00:00:00 GMT+0200 (Mitteleuropäische Sommerzeit) 
    // expected was Mon Sep 07 2015 00:00:00 GMT+0200 (Mitteleuropäische Sommerzeit)
    Tested on a system with german settings (Chrome 29), a week starts with monday here (not with sunday).

    So, is parsing of week/year formats buggy for some years?

    Thanks a lot!

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985

    Default

    Thanks for the report! I have opened a bug in our bug tracker.

  3. #3
    Sencha User
    Join Date
    Sep 2013
    Posts
    14

    Default Ext.Date.format with format 'W/Y'

    Note: Also Ext.Date.format maybe incorrect for some date values using format 'W/Y':
    Code:
    Ext.Date.format(new Date(2012,11,31), 'W/Y') // returns '01/2012' but expected was '01/2013'
    Ext.Date.format(new Date(2012,0,1), 'W/Y') // returns '52/2012' but expected was '52/2011'
    The generated function for 'W/Y' shows why: appending this.getFullYear() is not proper in general.
    Code:
    (function() {
    return Ext.String.leftPad(Ext.Date.getWeekOfYear(this), 2, '0')+'/'+Ext.String.leftPad(this.getFullYear(), 4, '0')
    })
    Thank you!

  4. #4
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258

    Default

    Can confirm the original issue, there's a problem when the first of the year falls on a Thursday.

    As for your second post, you should use the 'o' format instead of 'Y'.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  5. #5
    Sencha User
    Join Date
    Sep 2013
    Posts
    14

    Default

    Thanks for the tip to use 'W/o' format!

  6. #6
    Ext GWT Premium Member
    Join Date
    Oct 2009
    Posts
    143

    Default

    Ext.Date.parse('01/2015', "W/o");Date {Mon Jan 05 2015 00:00:00 GMT+0100 (CET)}

  7. #7
    Ext GWT Premium Member
    Join Date
    Oct 2009
    Posts
    143

    Default

    Code:
    Ext.Date.parse('01/2015', "W/o");
    Date {Mon Jan 05 2015 00:00:00 GMT+0100 (CET)}
    
    Ext.Date.format(new Date(2015,0,1), 'W/Y')
    
    
    
    "01/2015"
    
    Ext.Date.format(new Date(2015,0,5), 'W/Y')
    
    
    
    "02/2015"
    parsing iso week 01/2015 is wrong....

  8. #8
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258

    Default

    I can't reproduce this. I thought it may be a timezone based issue, so I tried setting my TZ to CET but I got the same result.

    Can you provide more information?
    Attached Images Attached Images
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  9. #9
    Ext GWT Premium Member
    Join Date
    Oct 2009
    Posts
    143

    Default

    hi,

    I have this issue at least with latest Firefox (auto updating itself, 34.0.5). Running on OS X 10.9.5.

    Code:
    Ext.Date.parse("01/2015", "W/o");
    
    
    
    Date {Mon Jan 05 2015 00:00:00 GMT+0100 (CET)}
    
    
    
    Ext.Date.parse("01/2015", "W/Y");
    
    
    
    Date {Mon Jan 05 2015 00:00:00 GMT+0100 (CET)}


    My timezone is CET (Europe/Budapest)
    Code:
    $ locale
    LANG=
    LC_COLLATE="C"
    LC_CTYPE="UTF-8"
    LC_MESSAGES="C"
    LC_MONETARY="C"
    LC_NUMERIC="C"
    LC_TIME="C"
    LC_ALL=
    $ date
    Wed Jan  7 08:48:50 CET 2015
    What else might you need?

    thx,
    Zol
    Attached Images Attached Images

  10. #10
    Sencha Premium User alexander.urban's Avatar
    Join Date
    Nov 2013
    Posts
    320

    Default

    Your Ext version. Because the problem is fixed in 4.2.3, but won't go magically away if you keep using 4.2.1 or 4.2.2.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •