+# keydate - date passed to calendar.js. calendar.js does not process dashes within a date.
+my $keydate;
+# calendardate - date passed in url for human readability (syspref)
+my $calendardate;
+my $today = C4::Dates->new();
+my $calendarinput = C4::Dates->new($input->param('calendardate')) || $today;
+# if the url has an invalid date default to 'now.'
+unless($calendardate = $calendarinput->output('syspref')) {
+ $calendardate = $today->output('syspref');
+}
+unless($keydate = $calendarinput->output('iso')) {
+ $keydate = $today->output('iso');
+}
+$keydate =~ s/-/\//g;
+