Documentation

Plugins/Calendar/ChangeRequests

From jQuery JavaScript Library

Jump to: navigation, search

Contents

Bug Reports

Misc Bugs

  • #101. Alex - "If a set a year range (let's say for a DoB), to be '-100:-18 (so only people older than 18 can enter), the first time it works fine (the range will be between 1907-1986). but if the user goes back to the field, and the calendar pops up again, this time it will use the year in the field to calculate the range (if he chose 1980, the range will be 1880-1962)."

Set your year range to a fixed range, e.g. $('input').calendar({yearRange: '1900:1990'});

  • #112. Alan - "It has a BUG in the date, from 03/11/2007. The days are missed and in October of 2009 they do not seem the days"
  • #147. Dan Evans - I found a bug that causes the calendar to pop up at the wrong times. This can be reproduced on your "miscellaneous" examples. If you first pick a date from the "reconfigured calendar" then you pick a speed from the drop down list. It opens the calendar again. I fixed this problem on my own system by commenting out lines 333 through 335 in jquery-calendar.js. They are the conditional in the _updateCalendar: function. I am on FireFox 2.0.0.6 Windows XP. Haven't tested it elsewhere yet.

PoZu [pozu@webnostra.com] on 9/4/2007

Hi Marc,

This is the link where I'm trying to implement your calendar script

http://www.webnostra.com/hostalmagnolia/reservas-hostal.asp

If you test it you can see that:

If you leave september the days of the month refresh ok on the outing date (Día de salida) If you choose October on the entry date (Día de entrada) the name of the monthrefreshes, but the days of the month don't. You 've got to choose a different month for it to refresh the days. I've tested the same on your web (date range) and it does the same.

Any idea what the problem is?

Thks and great job

PoZu pozu@webnostra.com

Chen Hailong [hlchen@ethos.com.cn] on 9/6/2007

Issue: if you have picked a starting date and then go to pick an end date, the picker should default to the same month/year as you selected for the start date.

Can you tell me how to solve this problem?

Thanks!


Dave Ferguson [dave@dkferguson.com] on 7/30/07

Hi,

First, and just encase you have not heard, the Calendar script is awesome. I felt I could help in some way so I made a modification to the script. I made it possible for the calendar to open where the mouse was clicked when using the showStandalone method. I am not a javascript expert so I am sure that the code is not perfect. I tested it on IE6 and FF2 and got no errors.


Here are the script alterations:

First, I passed in the event to the showStandalone method instead of a position array.

<A HREF="#" onClick="getPopUpDate(event);">Show Calendar</A>


Inside jquery-calendar.js I added this chunk of code. It checks to see if pos is an array, if not it checks to see if pos is an event. If that all fails it falls back to the original centering code.

Original (line 72,73):

this.pos

= pos || ($.blockUI ? [0, 0] : [(windowWidth - 200) / 2,(windowHeight - 200) / 2]); // should use actual width/height


New:

       if (pos.length == 2){
       this.pos = pos || ($.blockUI ? [0, 0] : [(windowWidth - 200) / 2, 
           (windowHeight - 200) / 2]); 
       } else { // event passed.  Position based on mouse click x/y
           var e = pos;
           if( !e ) { e = window.event; } 
               if( !e || ( typeof( e.pageX ) != 'number' && typeof( e.clientX ) != 'number' ) ) 
               { this.pos = [(windowWidth - 200) / 2,    (windowHeight - 200) / 2] }
           if( typeof( e.pageX ) == 'number' ) { 
           var posX = e.pageX; var posY = e.pageY; 
           } else {
           var posX = e.clientX; var posY = e.clientY;
           }  
           this.pos = [ posX+5, posY+5 ];
       }

w.andreas@gmail.com on 7/30/07

Dear Marc,

I noticed something at your jQuery Calender. I'm not sure wether it is wanted behaviour or not, but I feel it's "wrong".

When I use minDate and maxDate and the difference is very high your Calender only shows 11 entries. For example if I set 1927 and 1992 it only show the entries between 1992 and 1982. Once the user selects 1982 the Calender shows the years from 1972 to 1992. If he then selects 1972 the Calender shows the years from 1962 to 1982.

I tried to work around this by using yearRange which has the little flaw that it still displays the today button although today is not whithin the allowed range. Additionally it also shows the next button at the end which jumps to the very beginning and vice versa with the previous button (once again: might be wanted or not, thought I'd report it).

with kind regards Andrew

P.S.: I'm sorry if this isn't the right way to report bugs/suggest features, but I didn't find another one.

The yearRange attribute is what controls how many years are shown in the drop-down. It is designed to provide a useful range of years to select from, without overwhelming the user, and does not restrict the date overall. The presence or absence of the Today link is controlled by the minDate/maxDate attributes.

Feature Requests

Aaron Barker [aaron@emailaaron.com] on 8/29/2007

This is a better explanation of comment #103. Sorry the first one was so lame, it was abbreviated for the 300 char limit.

Anyway... what I am asking for is some way to mark that a calendar has already been attached to a given element, so that if the function to add calendars is run a second time, it doesn't attach it again.

The situation for this is if I run $(".calendar").calendar(); onload, but then I dynamically update the page with new content (via ajax, or whatever). Instead of tracking the calendar that I specifically added and calling it via an ID or something, I would like to just run $(".calendar").calendar(); again.

In other plugins I have seen this done via adding a class, and then making sure that class isn't there before running the code on it each time. Yes I could do that myself by doing $(".calendar").calendar().addClass("calendered"); and then subsequent times running $(".calendar").not(".calendared").calendar(); but if it was built into the script it leaves less room for error.

Naturally I can tweak the code myself as I hate to inflate the base code for a rarely used feature, but just thought I would toss it out there.

That's it... I have said it a few times in the comments, but thanks again for the efforts you put into this. It's a great product, and your responsiveness and active development is great!

Fields are now marked with 'hasCalendar' class and won't be re-processed.

Misc Feature Requests

  • "Set a flag of some kind like a class of "calendered" and only run on elements that didn't have that class. This would prevent any duplication on a given element if the call was made a second time (for dynamic content or whatever)."

Fields are now marked with 'hasCalendar' class and won't be re-processed.

  • #120. "I'd like to default the calendar to a future month. This is different than a range because I don't want to prevent the user from returning to a previous month."

defaultDate attribute added in v2.8 to set the initial date on opening.

  • "Add a class, such as 'calendared' to each element that a calendar is attached to"

Fields are now marked with 'hasCalendar' class and won't be re-processed.

  • dialogCalendar() supports an extra parameter "pos" to set position (needs to be an array with x,y)

This is already available: dialogCalendar(dateText, onSelect, settings, pos). Pos is the screen coordinates of top/left as [x, y].

  • #131. wes on Sep 03 2007 - Great Calendar, but I would love to be able to specify the initial date the calendar opens on rather than just today.

defaultDate attribute added in v2.8 to set the initial date on opening.

  • #144. Jim on Sep 04 2007 - Is there an example of how to use this when your date input is three SELECT elements instead of a single text field? eg: [MM] [DD] [YYYY]

Coming soon on the demo page - Miscellaneous tab.