chetang / calendardateselect

Automatically exported from code.google.com/p/calendardateselect
Other
0 stars 0 forks source link

Calendar does not pop up if incorrect date is entered #190

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
I have an input field and an image which attaches calendar to input when 
user clicks on an image

smth like this:

<input id="edit_field_1" class="editor_field" type="text" name="value" 
maxlength="255"/>
Image is created dynamically and onclick event is added this way:
var im = document.createElement('img');
im.setAttribute('src','../images/calendar.gif');
im.onclick=function(){new CalendarDateSelect($('edit_field_1'), 
{year_range:50,time:true})};

I manually enter a value into input field "11/12/208 01:55 PM" (as you see 
year is incorrect). Now when I click on an image calendar does not pop up 
and I see an error message in IE statusbar:

Line: 346
Char: 5
Error: Object doesn't support this property or method

I believe error is in line #346
this.selected_date = new Date(this.date);

,but not sure about this.

I think, calendar has to show current date if entered date is incorrect.

I'm using version 1.15 of a calendar_date_select.js and also I'm using 
format_american.js

Tried this on Windows XP SP3, IE-7.

Original issue reported on code.google.com by Ros...@gmail.com on 18 Jan 2010 at 1:30

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Actually, the same can be reproduced on demo page:
http://electronicholas.com/calendar?style=red&format=american

select "Popup Calendars" tab, enter "01/09/201" into first input field (No 
Time) and 
click on calendar image.

Original comment by Ros...@gmail.com on 18 Jan 2010 at 1:54

GoogleCodeExporter commented 8 years ago
workaround:
replace line #338
    if (isNaN(this.date)) this.date = new Date();
with this one:
    if (isNaN(this.date)||this.date<0)  this.date = new Date();

Original comment by Ros...@gmail.com on 29 Jan 2010 at 1:28