JSCal2-1.8

This release fixes a long standing, subtle bug that occurred during daylight saving time (DST) months. The problem was that the day during which DST occurred was sometimes displayed twice, and the rest of the calendar was wrong for that month.

It was really hard to track down the bug because it required a set of conditions in order to be able to reproduce it. I'll blog about it someday. It was reported a few times, here, here and here. I'm glad to say that it's finally fixed.

Other news:

  • added checkRange constructor argument.
  • fixed parsing of date + time (it was a bit random when time was included)
  • when showTime is true, read time too from the input field

Download JSCal2-1.8.zip.


94 comments so far (add yours)

JSCal2-1.8
by Felipe
2010-04-11 23:58

saludos, muy buen calendario

JSCal2-1.8
by majid
2010-04-12 07:17

very thanks

JSCal2-1.8
by hernan chang
2010-04-12 17:29

Es el mejor que he visto

JSCal2-1.8
2010-04-12 19:28

Very nice calendar and good to see this open source quality component.

JSCal2-1.8
by Startide
2010-04-13 12:43

Thank you very much for the timesaving bugfix !

JSCal2-1.8 12am bug
by JJ
2010-04-13 21:20

When using cal.manageFields and trying to select "12:00 am" it fails to copy the "am" to the field instead it populates the field with "12:00:00 pm" any ideas? please see example below

  Start: <input size="30" id="f_date1" /><button id="f_btn1">...</button><br />
  End: <input size="30" id="f_date2" /><button id="f_btn2">...</button><br />

  <script type="text/javascript">//<![CDATA[

    var cal = Calendar.setup({
        onSelect: function(cal) { cal.hide() },
        showTime: 12
    });
    cal.manageFields("f_btn1", "f_date1",  "%m/%d/%Y %I:%M %P");
    cal.manageFields("f_btn2", "f_date2",  "%m/%d/%Y %I:%M %P");

  //]]></script>
Re: JSCal2-1.8 12am bug
by JJ
2010-04-13 21:53

Referenced Dave's Comment from version 1.7 Post #17 Commented out and replaced the following lines:


// P=new Date(P.getFullYear(),P.getMonth(),P.getDate(),12,0,0);

P = new Date(P.getFullYear(), P.getMonth(), P.getDate(), 0, 0, 0);

// var ar=new Date(D.getFullYear(),0,1,12,0,0);

var ar = new Date(D.getFullYear(), 0, 1, 0, 0, 0);

//ar=new Date(aw,D-1,ar,au||12,av||0,at||0,P||0)

ar = new Date(aw, D - 1, ar, au || 0, av || 0, at || 0, P || 0);

//return new Date(parseInt(D[0],10),parseInt(D[1],10)-1,parseInt(D[2],10),12,0,0,0)

return new Date(parseInt(D[0], 10), parseInt(D[1], 10) - 1, parseInt(D[2], 10), 0, 0, 0, 0);


This appears to solve the issue.

Update Time in inputField
2010-04-14 19:59

if you add this to the Calendar.setup it will update the value of your inputbox when you change the time:

onTimeChange : function(cal){try{this.inputField.value = this.selection.print(this.dateFormat);}catch(e){}}

JSCal2-1.8
by jose
2010-04-19 15:11

I am using the calendar with a template I found on the web(multiflex - www.1234.info/webtemplates/multiflex5/). The problem I am having is with the css. When I put a calendar inside the page, the calendar explode in size. Most likely caused by the css table definition on the page template. My css knowledge is very limited, I just dont know how to fix it. This is a constant problem when trying to mix css made from different people.

Thank you

JSCal2-1.8
2010-04-22 13:45

I have an issue in FF. The month in the header table is left justified and not centered.

Anyone have a fix for this? I have a license, but don't know how to load the new source code.

you can see the problem here: http://angebote.tirol.at/art_resource.php?sid=sl6q.k5faam

Re: JSCal2-1.8
by sup
2010-06-11 19:25

Hi Frank,

I have the same issue in FF : "The month in the header table is left justified and not centered."

The same for the "today" button in the footer.

I saw in your site that you fixed the bug. How did you do ?

Thanks

Re: JSCal2-1.8
by Frank Di luzio
2010-06-13 18:56

I've been working hard on so many things that I can't tell you exactly what I did. However, I changed the css in some Table. Perhaps you load my CSS for the calendar. Otherwise, try looking at the css for the table where the Month is using Firebug by right clicking the element. If you compare mine with yours you might see the change.

I just looked and it might be here:

table.DynarchCalendar-titleCont { color:#444444; font-size:130%; font-weight:bold; text-align:center; }

Re: JSCal2-1.8
by sup
2010-06-14 14:41

Hi Frank,

Thks for your reply.

I've disabled another javascript in my site and that solves the problem.

JSCal2-1.8
2010-04-23 15:36

pięknie dziękuję za poprawkę - bardzo się przydała... czekamy na nowe updates :)

JSCal2-1.8
by bah2002us
2010-04-30 08:49

Where is the displayField for when i want to show a different date format (eg Monday, 24 October 2010) of the date when the inputField is hidden with a different date format (eg 2010-10-24).

Is it possible to add/get that displayField. Would be great!!!

JSCal2-1.8
by Yun
2010-04-30 18:53

Bug report: This only happens on the popup mode. The selected date on popup calendar is always one day earlier than it on input field if the input field has an existed one.

Any quick fix for this?

JSCal2-1.8
by Miki
2010-05-03 22:22

i Double the bug mentioned above. any date you select, the textfield shows it right, but you click to open the popup again, it is one day behind.

JSCal2-1.8
by Burak
2010-05-04 22:47

Great. Thanks for updating this wonderful piece of work. Keep up the good work.

JSCal2-1.8
by 童伟
2010-05-05 16:08

太好用,太感谢了,

JSCal2-1.8
by macleo
2010-05-10 10:56

david is your baby? very lovely.....very very pretty baby.... very like Babe Girl.....

JSCal2-1.8
by macleo
2010-05-10 17:32

sorry,I am come in again.... why JSCal2-.18 can't work with HTML elements FORM? How can I submit data?

JSCal2-1.8
by Matt
2010-05-12 16:28

Just a few small bugs:

1) When initialising the calendar, trying to set the initial time will not work, eg. setting: time: 1200, does nothing.

2) The time is not being rounded to the nearest minute step when initialising.

3) The onTimeChange callback is being called on initialisation. It would be nice if this didn't happen (or there was an option to turn it off).

4) Time is set to UTC initially, and not the local time.

Awesome calendar, thanks for the great work :)

JSCal2-1.8
by Victor
2010-05-12 16:39

Is it possible to bind a input field and a button for calendar control without id and using class? My controls are generated dynamically. So the input control & the button controls does not have the id but they are having class.

Thanks Victor

JSCal2-1.8
by zhengyutong
2010-05-13 08:27

The Calendar can't cover select element in IE6?

How to fix this problem?

Re: JSCal2-1.8
by Mihai Bazon (page author)
2010-05-13 09:05

Delete IE6. ;-)

Seriously now, I'm not spending one more second of my life to work around bugs in that browser. IE7, IE8 and previews of IE9 are already released. It took many long years and 3 strong competitors to put Microsoft to work, but finally, bye bye IE6.

Re: JSCal2-1.8
by lxhbs
2010-05-17 06:05

IE6? Oh that's already out of date. A mass of Chinese people should change their habits. XD

JSCal2-1.8
by Jose
2010-05-14 14:36

BUG: I cannot select and specific minute. When I click on the up-down arrows, the minutes do not go one by one making it impossible to select and exact time. Thank you

Re: JSCal2-1.8
by Nick
2010-05-21 09:08

READ THE DOCUMENTATION PEOPLE!

This isn't a bug. If you read the documentation, you would have seen and changed the minuteStep parameter to one in your constructor for the calendar.

JSCal2-1.8
by Omar Lerma
2010-05-17 19:26

Hello every one, i have a problem with this calendary when i put a method "post" in my form, this take off :(

JSCal2-1.8 bug in Google Chrome
2010-05-18 03:10

Hi!

  Selecting a range with the SHIFT key does not seem to work in Google Chrome (although works fine in FireFox).

  Actually, the arrow keys and page down key don't seem to work either... looks like the whole keyboard isn't connecting for some reason. Any ideas?

-Johnny

JSCal2-1.8
by Scott
2010-05-18 03:11

I have come across the same bug as posts 13 and 14, yun and miki. In popup mode the selected date displayed in the calendar is always one day previous to what was actually selected, and is actually populated into the input box. Please give us a fix for this.

JSCal2-1.8 bug in Google Chrome
2010-05-18 03:42

Hi!

  This is the most AMAZING calendar. Thank you!!

  Selecting a range with the SHIFT key does not seem to work in Google Chrome (although works fine in FireFox).

  Actually, the arrow keys and page down key don't seem to work either... looks like the whole keyboard isn't connecting for some reason. Any ideas?

-Johnny

JSCal2-1.8
by ecook
2010-05-18 12:27

Quite a cool look ! However, how could you POST time and date to insert it i a table Cheers

JSCal2-1.8 Chrome bug
by Gavin
2010-05-18 17:11

I am getting a 'uncaught illegal access' when using google chrome 6 (dev version) when going back a few months.

I found in the original calendar v1 code this was caused by the line date.setDate(-day1); The -day1 fails when day1 == 0 it needs to be preceded with 0 ie date.setDate(0-day1)

I suspect there is something similar in this version.

JSCal2-1.8
by Shail
2010-05-19 13:45

this calender not working in Ajax.

Re: JSCal2-1.8
by Shail
2010-05-19 13:54

this calender not working in Ajax.?

JSCal2-1.8 & IE6
by Gavin
2010-05-19 18:26

When Calendar2 is dragged over a listbox the listbox shows on top. The old Calendar1 woudl hide the listboxes as you dragged over them. Has this feature been removed?

JSCal2-1.8
by Scott
2010-05-19 20:14

In response to my previous post above (#27), the bug involving the calendar displaying the previous day is selected in popup mode appears to be due to a time zone difference calculation. When the "Today" button is clicked, the time is set to GMT. This same time difference appears to be used when displaying the date on the popup mode, causing it to show the previous day depending on the time entered.

JSCal2-1.8
by Scott
2010-05-19 20:15

Please help above!

JSCal2-1.8
by Scott
2010-05-19 22:48

Nevermind, I found a solution to the above timezone bug(?) (post #34, #13, #14). You can account for your timezone offset (Which causes the calendar to display yesterday's date) by adding the Date.getTimezoneOffset value (in milliseconds) to the Date Object constructed at the end of Calendar.parseDate() to be returned.

Re: JSCal2-1.8
by John
2010-05-21 09:18

Can you post the exact code that fixes the bug? Preferably something that could be used in the constructor setup of the calendar?

Re: JSCal2-1.8
by JJ
2010-08-05 23:20

To fix the TimeZoneOffset aka previous day shown when 12:00am time is specified. Find the following line

function V(D){if(D instanceof Date){

Add this line after

D = new Date(D.getFullYear(), D.getMonth(), D.getDate(), D.getHours(), D.getMinutes(),D.getSeconds(), D.getTimezoneOffset() * 60 * 1000);

Hope this helps...

JSCal2-1.8
by Jose
2010-05-21 13:12

Nick, Thank you for the advise. In my defense. I just could not think of any reason why the default might not be one. So I assumed it was a bug. But you are right. It works. I would suggest changing the default to 1. If you go to the trouble of activating the time, you most likely need specific time and not time intervals. IMHO

JSCal2-1.8
by Sebastian
2010-05-22 04:17

I'd like to have a multiple selection but only one range from beginning to end, the selection of the first selected date to the last selected date (without the shift-keys) works fine, but when i'm clicking some in the selected range only the clicked date is unselected so i need a unselect hook to prevent this behaviour, is there any possibility already which i didn't saw?

JSCal2-1.8
by ezair
2010-05-24 13:14

if you change the year to 0 or below, all the data will turn to "NaN" and can't be recovered unless you refresh the page. And if you push Backspace while editing the year number, the page will go back. can you capture the action? Thanks for your excellent work!

JSCal2-1.8
2010-05-24 20:58

Awesome!!!! Trank you!!!

JSCal2-1.8
by roberto
2010-05-25 06:05

hola como le hago para que funcione este calendario me gustaria que me dijeran pero por pasos gracias

parseDate subtracts four hours from the date
by Paul
2010-05-26 07:41

The following code replicates a bug that subtracts four hours from the date, where the value of the calendar_input input element is "2010-05-26 04:30:00"

el = document.getElementById('calendar_input'); date = Calendar.parseDate( el.value, true); el.value = Calendar.printDate( date, "%Y-%m-%d %H:%M:%S");

Re: parseDate subtracts four hours from the date
by Paul
2010-05-26 07:44

This happens on multiple instances of calls to parseDate, not just this one. In general, every use of parseDate is returning a date that is four hours less than the correct date.

Re: parseDate subtracts four hours from the date
by Mihai Bazon (page author)
2010-05-26 09:00

In fact, what happens is that parseDate assumes that the date to be parsed is in GMT. Then when you "print" it, it comes out according to the timezone of the browser, which is why you see the difference. Try alert(date.toUTCString()) instead of Calendar.printDate and it should output the date that has been read.

This is a regression introduced with some fixes in the last version. Since there is no timezone, I would think that assuming GMT is a good approach, but it's too counter-intuitive to keep it this way.

I will fix it in a coming release.

JSCal2-1.8
by Fernando Piedra
2010-05-26 18:37

Ecxelente!!

How can I select multitple dates via javascript?
by dohhomer
2010-06-01 21:20

I like to select all the Mondays or other day of the week... Is this posible (with a function in javascript)?

Thanks in advance. :-)

JSCal2-1.8
2010-06-02 23:43

I would like to use the JSCal2 library for our internal development. I have been playing with it and it works great. I have ran into a problem in some of our pages, where the inputField is within a scrollable <div> which sized to prevent the window's scrollbars from appearing.
The popup calendar is placed at the position of the input element before the scrolling.

I hope this is clear...

What can I do?

JSCal2-1.8
by David
2010-06-04 16:34

Thanks you very much for you pretty calendar :)

JSCal2-1.8
by Daniel
2010-06-09 19:55

Hola, en Google Chrome el calendario no visualiza bien los meses cuyo día 1 es el primer día de la semana.

Por Ejemplo febrero y marzo de 2010 si el primer dia es el lunes.

Un saludo

JSCal2-1.8
by AleXXX
2010-06-11 10:28

This is best calendar.

JSCal2-1.8
by Giovanny
2010-06-14 21:18

Excelente!!! felicidades, buen trabajo :)

JSCal2-1.8
by Breim
2010-06-15 13:15

i find this calendar very cool and want to use it with DWR in an application using JAVA tech, so i didn't find how to get the current month using onChange event ?

Bug in JSCal2-1.8
by Jonas
2010-06-17 12:40

When flipping from April 2010 to March 2010 the JS code threw an exception in my browser (Chrome). After beautifying the compressed code on http://jsbeautifier.org/ I saw that the exception was thrown in function "ac" on line 535:

aG.setDate(-az);

The exception was thrown due to az being zero. After adding the check

if (az != 0) { aG.setDate(-az); }

Thing seem to work again.

-Jonas

JSCal2-1.8
by xpnew
2010-06-19 22:23

My English is not very good,please forgive me! Thank you very much to this program! However, I found a BUG when I used. When used to "selectionType: Calendar.SEL_SINGLE", "showTime: 12", just click on a date (besides today), the time at the bottom of the controls it will jump to 04:00. If you email to me ,I will send you the pictures.

I'll send the screenshots and video to you.(Relevant BUG) My email: xpnew#126.com (#=@)

Below is Chinese: (下面开始是中文) 我的英文不太好,请你多理解! 非常感谢你们这个程序!不过,我使用的时候发现一个BUG。 当使用到了"selectionType: Calendar.SEL_SINGLE","showTime: 12"的时候,点击一个日期(除了今天以外),下面的时间就会跳到04:00。 如果,你们给我发邮件,或者让我知道你们的邮件地址,我可以把这个BUG的屏幕截图或者录像发送给你们。 我的邮件地址是:xpnew#126.com (为了防止垃圾邮件,请把#替换成@)

Popup double calendar
by Danilo
2010-06-21 18:05

Hello, the calendar is really nice! My compliments. Sorry for my English... I have prepared a STATIC double calendar, visible here: http://www.deasistemi.net/calendario/calendario.html

Is possible to make a POPUP double calendar that appears on pressing the button?

Thank you. Danilo (Italy)

JSCal2-1.8
by Nacho
2010-06-21 19:30

Hi, thanks for the application. Would it be possible to create property 'enabled' to do just the opposite of property 'disabled' to allow selecting only a certain time?

Thanks!

Re: JSCal2-1.8
by Mihai Bazon (page author)
2010-06-21 20:41

Not impossible, but it would be redundant, since you can accomplish the effect by using the "disabled" handler.

JSCal2-1.8
by Ernesto
2010-06-21 22:45

Ayuda por favor por que con Internet Explorer 8 me aparece un error: object expected.

JSCal2-1.8
by Nacho
2010-06-22 10:39

Ok, thanks for the reply

JSCal2-1.8 - Safari & Chrome bug
by Fabien
2010-06-28 16:58

Hello, found some problem with thoses 2 browsers.

You can see on your home page :

1 > go to your homepage 2 > Clic on Month Name, top of the bar 3 > The menu open 4 > Now look at the lsit below to see which are working and other note :

Month working and reacting to selection: Jan Apr May Jun Jul Aug Sep Oct

Month clickable but not reacting to selection : Feb Mar Nov

JSCal2-1.8
by George
2010-06-28 18:32

Hi, my question is can I display multiple months? This may be a good options for the calendar. I found a bug on this version, when one date is displayed on the output textbox, the calendar set your selected date at this date, but substract one day. You can check it in your main page demos.

JSCal2-1.8
by Theophile
2010-06-30 13:03

Thanks very much, it's pretty good.

Calendar-setup.js,v 1.1
by Prakash
2010-07-12 11:58

Hi,

I have a different issue in IE6 only. please follow the below steps. 1. create a combobox in a html page. 2. create a button(to show a popup). 3. create div as like a popup and position it as it covers combox. 4. create a textbox and an image in the popup to show the calendar.

now my issue is, if i click on the calendar image, it is showing the combobox along with the calender design on top the popup. if i close the calendar it is hiding.

please help to resolve this issue.

Today disabled
by GDelacroix
2010-07-15 18:39

Hi ! I think I've found a small bug : when the current day is disabled (by 'max' parameter), clicking on "today" will select the current day anyway...

I think the good behaviour is to disable 'today' button if the current day is disabled...

Great job anyway ! Regards.

Midnight Bug
by GDelacroix
2010-07-15 20:45

Another bug : with time feature, when setting hour to "00", this sets "12" in input field, even in 24h format.

No problem with hours from 13 to 23.

Regards

Re: Midnight Bug
by GDelacroix
2010-07-15 20:50

This only concerns inputField update. The calendar date selector correctly displays "00"

JSCal2-1.8
by axel
2010-07-17 13:05

Fantastic

JSCal2-1.8
by Julio
2010-07-21 22:34

excelente, muchas gracias, saludos

JSCal2-1.8
by Ronaldo
2010-07-22 23:31

I'm having trouble adding the calendar to a form: once I press the button to make the calendar pop-up and select the date, the form is submitted without even allowing to select a date, even though there's a submit button at the end of the form.

Thanks for the help you can give me

Time correction
by Sebastian
2010-07-23 13:38

Time is initially shown as UTC (see http://www.dynarch.com/projects/calendar/download/1.8/#Kcomment-1340). I worked around this by appending var jetzt = new Date(); cal.time = jetzt.getHours() * 100 + jetzt.getMinutes(); cal.redraw();

Ugly, but it works.

Re: Time correction
by Sebastian
2010-07-23 13:40

setTime() and the initial config object "time" did not work

ontimechange
by peter
2010-07-26 14:48

My date field format will be "05 Feb 11, 12:02" like this .I used onselect method to get input field value onSelect : function(){var date=this.selection.get();date = Calendar.intToDate(date);date = Calendar.printDate(date, "%d %b %y, %k:%m");document.getElementById("timeTxt").value=date; but when ever i change the time it didn't reflect on input field but date has updated am i miss anything.... i need ur help guys ... Thankyou in Advance

JSCal2-1.8
by wang
2010-07-27 06:19

你好!

Invalid year
by anton.grinenko
2010-07-27 09:18

Greetings all, I found some strange behaviour in a calendar. If I manually fill the year input field with text "88888888" I'll get "undefined NaN" text output for year label and "NaN" text for every calendar day. It is not acceptable for my application. Client doesn't like it. Can you help me to fix this problem? Any advice?

JSCal2-1.8
by MaxDM
2010-07-28 11:58

Greetings all!

I have some problems when the initial time is set. For example: <form action="javascript:void(0);"> <input id="f_rangeStart" value="15/07/2010 15:00"/> <button id="f_rangeStart_trigger">...</button> <script type="text/javascript"> Calendar.setup({ inputField: "f_rangeStart", dateFormat: "%d/%m/%Y %H:%M", trigger: "f_rangeStart_trigger", weekNumbers: false, showTime: true, minuteStep: 1 }); </script> </form>

So, the time is set to 15:00 and it's correctly displayed in the input box. When I push the button to select another day, the time is reseted to 00:00.

How to make sure that time is not reset to 00:00 when I select another day?

How Disable Range
by pat
2010-07-29 13:32

I need to disable the range function. I need to print every date selected. es: 05-17-2010->05-20-2010 i need to fill the input field with 05-17-2010, 05-18-2010, 05-19-2010 etc....

thanx for your help

JSCal2-1.8
by Irfan Ahmed
2010-08-03 14:05

perfect , works event after ajax div replacement by firing the calendar script correctly.

Thanks Irfan Ahmed

JSCal2-1.8 issue in chrome
by peter
2010-08-05 13:49

Calendar works fine in Firefox,IE. But in chrome newer versions such as(5.0.375.9 or 6)it(calendar) doesn't appear. My code is Calendar.setup({ inputField : "timeTxt",//input field dateFormat : "%d %b %y, %k:%M", fdow : 0, fdow : 0, align : "mouse", onSelect : closeCalendar }

JSCal2-1.8
by J.Carvalho
2010-08-19 20:32

Is it possible to disable the mouse scroll wheel?

JSCal2-1.8
2010-08-22 17:43

very thank you good job (:

JSCal2-1.8
by Samuel pichardo
2010-08-25 20:31

Gracias por el calendario, este calendario lo uso frecuente mennt en las aplicaciones web que realizo, me bajare esta verción.

JSCal2-1.8
by Richard
2010-08-27 23:28

Excelente... Gracias por el aporte

JSCal2-1.8
by Kenneth
2010-08-30 06:48

Excelente... Gracias por el aporte

JSCal2-1.8
2010-08-30 09:38

Greetings all, I found some strange behaviour in a calendar. If I manually fill the year input field with text "88888888" I'll get "undefined NaN" text output for year label and "NaN" text for every calendar day. It is not acceptable for my application. Client doesn't like it. Can you help me to fix this problem? Any advice?

JSCal2-1.8
by Trinh Dung
2010-08-30 10:34

I want to use arabic number in calendar So what should I do ?

JSCal2-1.8
by garima
2010-08-30 12:24

calandar

JSCal2-1.8
by jalend
2010-08-31 02:14

Integration JSCal2 into Joomla: http://extensions.joomla.org/extensions/calendars-a-events/calendars/13801

language
by Odile
2010-09-06 21:05

Hello, I need some help about change the language. The calendar I have is in English but I have the .js in spanish but I don't know where I must put it.

Thanks in advance.

Add your comment

You can use the MultiMarkdown syntax, with some decent restrictions (no plain HTML, no headings). Your email address will not be published.

*
*