AdelMoustafa / jmonthcalendar

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

onDayCellClick date #15

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. View demo for 1.3.0 beta
2. Click on a day

What is the expected output? What do you see instead?
Alert will display the last day of the month instead of the day that was
clicked

What version of the product are you using? On what operating system?
1.3.0 beta

Please provide any additional information below.
1.2.2 is working correctly

Original issue reported on code.google.com by alanvi...@gmail.com on 1 Jul 2009 at 4:03

GoogleCodeExporter commented 8 years ago
            //DateBox Events
            var dateLink = jQuery('<div class="DateLabel"><a href="">' + currentDate.getDate()
+ '</a></div>').click(function(e) {
                defaults.onDayLinkClick(currentDate);
                e.stopPropagation();
            });

            var dateBox = jQuery("<td></td>").attr(atts).append(dateLink).dblclick(function(e) {
                defaults.onDayCellDblClick(currentDate);
                e.stopPropagation();
            }).click(function(e) {
                defaults.onDayCellClick(currentDate);
                e.stopPropagation();
            });

Change this to:
            //DateBox Events
            var dateLink = jQuery('<div class="DateLabel"><a href="">' + currentDate.getDate()
+ '</a></div>').click(function(e) {
                defaults.onDayLinkClick(new Date($(this).attr("date")));
                e.stopPropagation();
            });

            var dateBox = jQuery("<td></td>").attr(atts).append(dateLink).dblclick(function(e) {
                defaults.onDayCellDblClick(new Date($(this).attr("date")));
                e.stopPropagation();
            }).click(function(e) {
                defaults.onDayCellClick(new Date($(this).attr("date")));
                e.stopPropagation();
            });

Hope that helps :)

Thanks for the project, btw!

Original comment by insolen...@gmail.com on 12 Jul 2009 at 11:13

GoogleCodeExporter commented 8 years ago
Actually that doesn't fix the LINK, but I bet I can, gimmie a minute!

Original comment by insolen...@gmail.com on 12 Jul 2009 at 11:15

GoogleCodeExporter commented 8 years ago
            //DateBox Events
            var dateLink = jQuery('<div class="DateLabel"><a href="#">' +
currentDate.getDate() + '</a></div>').click(function(e) {
                defaults.onDayLinkClick(new Date($(this).parent().attr("date")));
                e.stopPropagation();
            });

            var dateBox = jQuery("<td></td>").attr(atts).append(dateLink).dblclick(function(e) {
                defaults.onDayCellDblClick(new Date($(this).attr("date")));
                e.stopPropagation();
            }).click(function(e) {
                defaults.onDayCellClick(new Date($(this).attr("date")));
                e.stopPropagation();
            });

Think that gets it.

Original comment by insolen...@gmail.com on 12 Jul 2009 at 11:17

GoogleCodeExporter commented 8 years ago
Thanks

Original comment by alanvi...@gmail.com on 12 Jul 2009 at 11:29

GoogleCodeExporter commented 8 years ago
Thanks for the issue, I found the issue I think.  Instead of your new Date() I 
used a clone() method which will 
return a new date/copy.

Original comment by k.leneau@gmail.com on 19 Jul 2009 at 7:01

GoogleCodeExporter commented 8 years ago

Original comment by k.leneau@gmail.com on 19 Jul 2009 at 7:09