Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: calendar bug

  1. #1
    New Coder
    Join Date
    Oct 2006
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    calendar bug

    Sorry it this is not the right place for such questions.I am trying to use a calendar in java script from ruajava.net but the calendar shows 32 day for October (Outubro). Any clue on the error ? script attached.Thanks a lot
    Attached Files Attached Files

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,017
    Thanks
    203
    Thanked 2,538 Times in 2,516 Posts
    This appears to have fixed it. Add the line shown in red.


    function set_cal(show_date)
    {
    begin_day = new Date (show_date.getYear(),show_date.getMonth(),1);
    begin_day_date = begin_day.getDay();
    end_day = new Date (show_date.getYear(),show_date.getMonth()+1,1);
    count_day = (end_day - begin_day)/1000/60/60/24;
    count_day = Math.round(count_day);
    input_table(begin_day_date,count_day);
    }

    This trouble seems to arise in March and October only. In all other months count_day returns an integer, i.e the number of days in the month.
    Last edited by Philip M; 10-21-2006 at 09:08 AM.

  • #3
    New Coder
    Join Date
    Oct 2006
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks Philip.
    Now works fine.
    Have a nice Sunday!

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,017
    Thanks
    203
    Thanked 2,538 Times in 2,516 Posts
    "This trouble seems to arise in March and October only. In all other months count_day returns an integer, i.e the number of days in the month."

    I should have made the point that the problem arises out of daylight saving or summer time, which adds or subtracts one hour from the month, leading to non-integer values for the calculated number of days - 31.0416 and 30.9583.
    Last edited by Philip M; 10-22-2006 at 07:23 PM.


  •  

    Posting Permissions

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