1. #1
    Sencha User kryo's Avatar
    Join Date
    Jan 2010
    Location
    Costa Rica
    Posts
    34
    Vote Rating
    0
    kryo is on a distinguished road

      0  

    Cool [3.x] Ext.date.RangeField

    [3.x] Ext.date.RangeField


    Ext.date.RangeField is a completely new rewrite of "Ext.ux.form.DateRange". Fixes lots of problems, code has been cleaned up and well documented. Demo/documentation has also been updated to reflect changes. Any questions, feel free to let me know.

    Like it's ancestor, this version also bundles DateJs. This version separates the DateJs locale information so you can include this independently for globalization. I had to remove all the standard DateJs globalizations because Sencha's forum didn't like the file size apparently. This only bundles en-US.js, sorry all international users! :s

    Download plugin here: Ext.date.RangeField-0.1rc.zip
    Live demo: http://jsfiddle.net/2P7K9/

    News
    • 02/05: Updated linguistic error with preset date names, now they say "Month to date", "Year to date", etc. Also fixed IE8 bug reported by sb32.
    • 01/30: Updated to allow pickers to update values based on current dates selected.

    You can view the old version here:
    http://www.sencha.com/forum/showthre...form.DateRange
    Attached Images
    Last edited by kryo; 18 Feb 2011 at 5:50 PM. Reason: Put ExtJs version compatibility in title
    --
    Hans Doller
    hans@w3forge.org
    Senior Web Developer & Consultant

    Contributed Plugins: Ext.date.RangeField, Ext.money.Exchange, Ext.locale.Format, Ext.ux.Bootstrap

  2. #2
    Sencha User sb32's Avatar
    Join Date
    Sep 2007
    Posts
    66
    Vote Rating
    0
    sb32 is on a distinguished road

      0  

    Default Nice

    Nice


    Great add-in..

    small linguistics issue..

    use MonthToDate instead of MonthToDay ... and the same goes for YearToDate vs YearToDay

    http://en.wikipedia.org/wiki/Month-to-date

    hope this helps and thanks again!!

  3. #3
    Sencha User kryo's Avatar
    Join Date
    Jan 2010
    Location
    Costa Rica
    Posts
    34
    Vote Rating
    0
    kryo is on a distinguished road

      0  

    Default


    Thanks for the suggestion. I'll make the change and put up a new version.
    --
    Hans Doller
    hans@w3forge.org
    Senior Web Developer & Consultant

    Contributed Plugins: Ext.date.RangeField, Ext.money.Exchange, Ext.locale.Format, Ext.ux.Bootstrap

  4. #4
    Sencha User sb32's Avatar
    Join Date
    Sep 2007
    Posts
    66
    Vote Rating
    0
    sb32 is on a distinguished road

      0  

    Default


    few other things..

    CUstom date ranges don't render properly in IE8 (nor does your example at http://jsfiddle.net/2P7K9/ in ie8)

    until resolved, I tried to remove the range picker but of course it's assumed to be there ( not a removable preset)

    so I had to comment it out further down

  5. #5
    Sencha User kryo's Avatar
    Join Date
    Jan 2010
    Location
    Costa Rica
    Posts
    34
    Vote Rating
    0
    kryo is on a distinguished road

      0  

    Default


    Interesting, I don't use IE here which is why it must have slipped by. I will try it out and see if I can find out what is breaking in IE8 -- thanks for the report(s). If you have an idea what is causing the break in IE8, it would help me out. Btw, I updated the release with the fixed linguistics.. as soon as we discover what's up with IE8, i'll put out a new patch.
    --
    Hans Doller
    hans@w3forge.org
    Senior Web Developer & Consultant

    Contributed Plugins: Ext.date.RangeField, Ext.money.Exchange, Ext.locale.Format, Ext.ux.Bootstrap

  6. #6
    Sencha User sb32's Avatar
    Join Date
    Sep 2007
    Posts
    66
    Vote Rating
    0
    sb32 is on a distinguished road

      0  

    Default


    I tried to work out what the issue was - however IE compatability issues are not always trivial. Look forward to seeing a fix, thanks again

  7. #7
    Sencha User kryo's Avatar
    Join Date
    Jan 2010
    Location
    Costa Rica
    Posts
    34
    Vote Rating
    0
    kryo is on a distinguished road

      0  

    Default


    I think I found the issue is with the hbox layout of the custom date range. I changed it to a column layout, and it is now working in IE8. Updating the version now.
    --
    Hans Doller
    hans@w3forge.org
    Senior Web Developer & Consultant

    Contributed Plugins: Ext.date.RangeField, Ext.money.Exchange, Ext.locale.Format, Ext.ux.Bootstrap

  8. #8
    Sencha User kryo's Avatar
    Join Date
    Jan 2010
    Location
    Costa Rica
    Posts
    34
    Vote Rating
    0
    kryo is on a distinguished road

      0  

    Default IE8 Bug Fixed

    IE8 Bug Fixed


    New version is attached to thread.
    --
    Hans Doller
    hans@w3forge.org
    Senior Web Developer & Consultant

    Contributed Plugins: Ext.date.RangeField, Ext.money.Exchange, Ext.locale.Format, Ext.ux.Bootstrap

  9. #9
    Sencha User sb32's Avatar
    Join Date
    Sep 2007
    Posts
    66
    Vote Rating
    0
    sb32 is on a distinguished road

      0  

    Default Thanks

    Thanks


    One design consideration you may want to consider is:

    Since it's a date range plugin - implement each option in such a way that it returns just that - a date range. For example, in the case of 'Today', return two date objects for the same date(today).


    This makes using your plugin much easier in my opinion. Most services that deliver data given a specific date range, expects just that a range - even if it's the same start and end date. Your plugin made it hard for me to decipher what mode was used, thus making it hard to determine what a nil 'to' date would be. If you always return a date range, you decouple the user selection from the handling of values. (for the most part).

    Examples:

    PHP Code:
                text'After date',
                
    iconCls'calendar',
                
    menu: new Ext.menu.DateMenu({
                   
    handler: function(dpdate){
                      
    DATE_MIN date.add(Date.DAY,1);
                                  
    DATE_MAX = new Date();
                   }
               }) 
    PHP Code:
            '-', {
                
    text'Specific date',
                
    iconCls'calendar',
                
    menu: new Ext.menu.DateMenu({
                   
    handler: function(dpdate){
                      
    DATE_MIN date;
                                  
    DATE_MAX date.clone();
                   }
               })
            } 

    PHP Code:
            '-', {
                
    text'Month-to-date',
                
    handler: function() {
                     var 
    = new Date().clearTime();
                     
    DATE_MIN Date.parse(d.format('m/01/Y'));
                     
    DATE_MAX d;
                }
            } 
    Just an opinion though.. :-) Hope this helps and thanks for the quick response!!

    fyi - DATE_MIN and DATE_MAX above are equiv to your to and from variables.
    Last edited by sb32; 6 Feb 2011 at 12:42 PM. Reason: var name comment

  10. #10
    Sencha User kryo's Avatar
    Join Date
    Jan 2010
    Location
    Costa Rica
    Posts
    34
    Vote Rating
    0
    kryo is on a distinguished road

      0  

    Default


    Thanks for your suggestion sb32, I guess for my purposes I didn't need to have it that way. But feel free to make an extension off of this that handles presets the way you need. It should be pretty simple to achieve that functionality. It might be even easier to add a new method to the class that always returns a date range (array). That way you'll always have two values, but if for some reason a single date is supplied, one would be false.
    --
    Hans Doller
    hans@w3forge.org
    Senior Web Developer & Consultant

    Contributed Plugins: Ext.date.RangeField, Ext.money.Exchange, Ext.locale.Format, Ext.ux.Bootstrap

Similar Threads

  1. How can select future day date only not a past date and current date
    By painter in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 6 Apr 2009, 10:11 PM
  2. GridView date and date store Date
    By saipkjai in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 21 Jan 2009, 7:19 PM
  3. How to set month start date month end date default in date field
    By frank_ash in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 17 Oct 2008, 6:59 AM
  4. Newbie Question about disable shadow of the date picker's date field
    By fm424946 in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 13 Nov 2007, 9:02 AM

Thread Participants: 9

Tags for this Thread