Home
Google
 


Javascript Calendar Widget v1.07

This is just un update for the original calendar script. It includes the american date format(year-month-day). It’s also the default setting now so if you need other formats you’ll have to play with the options. All the other stuff remain as in the first version, so you’ll find the documentation here.

You can download it here. A working example can also be found here (click on the input).

Comments

  1. Jason wrote:

    How can I format the date as mm/dd/yyyy when inserting into my text box?

  2. Jason wrote:

    Also, how can I get Sunday to be the starting day of the week, and Saturday the end day?

  3. Jason wrote:

    Another thing, in IE6, if you have a select box right below the input box that the calendar is asociated with, the calendar goes behind the select. Can that be fixed?

  4. C.R. Dick wrote:

    Does the calender pop over other content on the page?

  5. adisan wrote:

    it does not pop. It simply shows a calendar over the content, based on the settings you’ve chosen.

  6. Paul A wrote:

    Thanks for a great script.

    The first 40 lines contains the configuration.

    Check out this line for changing the date format:
    formatType = “dd”+formatSplitter+monthFormat+formatSplitter+yearFormat;

    And the “yearFormat”. Set it to “yyyy”

  7. Lidia wrote:

    Very nice…
    But still no answer for Jason… I ask the same:
    “how can I get Sunday to be the starting day of the week, and Saturday the end day?”

  8. adisan wrote:

    well, this is a feature yet to be implemented.

  9. Daniel wrote:

    Where are you setting monday as day 0? I’d just like to change that to sunday.

  10. Daniel wrote:

    To make Sunday the first day change the following:

    Line 104: var DayCol = new Array(”S”, “M”, “T”, “W”, “T”, “F”, “S”);
    Line 197: for(i=0;i 0)
    Line 215: dayCell.innerHTML = “ ”;

    Line 272-279:
    isWeekend: function(tDay)
    {
    sun = new Date(this.selYear, this.selMonth, tDay).getDay();
    sat = new Date(this.selYear, this.selMonth, tDay).getDay();
    if(sun==0||sat==6)
    return true;
    return false;
    },

  11. Daniel wrote:

    Line 197: needs to be
    for(i=0;i

  12. Daniel wrote:

    One last try

    for(i=0;i<=getDaysInMonth(this.selMonth, this.selYear); i++)

  13. Edward wrote:

    Hi,

    I got two problems… the first one is with the day before to the first day to the month, im getting a 0 on that day. So my calendar starts as 0, 1, 2, 3, etc. I did what Daniel says about to change sundays as the first day of the week, but i don’t know what is wrong with it.

    The second is with the date format. I’m trying to get the mm/dd/yyyy, but when i trying to use this code:

    formatType = monthFormat+formatSplitter+”dd”+formatSplitter+yearFormat;

    The calendar appears like uncomplete.

    Any idea about this? Thanks,

    Ed

  14. winard wrote:

    for daniel.. im not js guru but when i followed ur instruction on no. 10 comment. i have problem in days it start from 0 instead to 1.. so i guessed it should be

    line 197 : for(i=1;i

  15. baji wrote:

    this going down to dropdownlist,how to privent this problem?

    Please help….

  16. ChrisT wrote:

    13. Ed: here’s a work around for the date format. It may not be exactly what you want, but for me it was acceptable.

    change
    line 27 on calendar.js to:
    formatInputs = 3

    change function code on form page to:
    choose

    then make 3 text fields instead of one:

    you can then combine them + generate a timestamp with php code for your data base input

  17. ChrisT wrote:

    opps: let’s try that again:

    change
    line 27 on calendar.js to:
    formatInputs = 3

    change function code on form page to:
    :
    choose

    then make 3 text fields instead of one:
    :
    :
    :

    you can then combine them + generate a timestamp with php code for your data base input

  18. crystal wrote:

    an answer for the month starting with “0″….add this:

    if(tDay

  19. crystal wrote:

    ack! sorry for the junk post. I’ll try again here.

    an answer for the month starting with “0″….add this:

    if(tDay < 1)
    return false;

    within the isValidDate fuction found on line 244. this should be the first if statement within that function. it worked for me anyway….hope it helps

  20. crystal wrote:

    also to get the date in the right order try fixing line 546 to be:

    document.getElementById(elem1).value = tMonth + formatSplitter + tDay + formatSplitter + tYear;

  21. Mark wrote:

    Thank you all for the helpful tips on setting Sunday as the first day and for setting the date format!

  22. Mark wrote:

    OK, I’m also seeing the “Day 0″ issue. Here’s a fix on approximately line 246, just below the function name “isValidDate: function(tDay)”

    Add this two lines:

    if (!(tDay>0))
    return false;

  23. Mark wrote:

    Here’s a full fix reflecting Daniel’s solution:

    To make Sunday the first day change the following:

    Line 104: var DayCol = new Array(”S”, “M”, “T”, “W”, “T”, “F”, “S”);

    Line 197: for(i=0;i0)) // Add this line
    return false; // Add this line

  24. Mark wrote:

    Forget the above comment.. it’s not being displayed properly. Just look at Daniel’s comment #10, and then Daniel’s comment #12. Finally, add this to prevent the display of the zero (0) Calendar date:

    Line 244:
    isValidDate: function(tDay)
    {
    if (!(tDay>0)) // Add this line
    return false; // Add this line

  25. terence wrote:

    I’d like the calendar to set all the past dates including today not selectable.
    How can i do this? thanks

  26. adisan wrote:

    @terence
    itype=’strict’;
    imaxDays = 900;
    Max Days sets the timespan for your selection enabled calendar in days.
    Then set startDay, startMonth and startYear as the first day from when you need to have your selections enabled.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*

*