1 <script type="text/javascript">
4 var debug = "[% debug %]";
5 var dformat = "[% dateformat %]";
7 if (debug > 1) {alert("dateformat: " + dformat + "\ndebug is on (level " + debug + ")");}
9 function Date_from_syspref(dstring) {
10 var dateX = dstring.split(/[-/]/);
11 if (debug > 1 && sentmsg < 1) {sentmsg++; alert("Date_from_syspref(" + dstring + ") splits to:\n" + dateX.join("\n"));}
12 if (dformat === "iso") {
13 return new Date(dateX[0], (dateX[1] - 1), dateX[2]); // YYYY-MM-DD to (YYYY,m(0-11),d)
14 } else if (dformat === "us") {
15 return new Date(dateX[2], (dateX[0] - 1), dateX[1]); // MM/DD/YYYY to (YYYY,m(0-11),d)
16 } else if (dformat === "metric") {
17 return new Date(dateX[2], (dateX[1] - 1), dateX[0]); // DD/MM/YYYY to (YYYY,m(0-11),d)
19 if (debug > 0) {alert("KOHA ERROR - Unrecognized date format: " +dformat);}
24 /* Instead of including multiple localization files as you would normally see with
25 jQueryUI we expose the localization strings in the default configuration */
27 $.datepicker.regional[''] = {
31 currentText: _('Today'),
32 monthNames: [_('January'),_('February'),_('March'),_('April'),_('May'),_('June'),
33 _('July'),_('August'),_('September'),_('October'),_('November'),_('December')],
34 monthNamesShort: [_('Jan'), _('Feb'), _('Mar'), _('Apr'), _('May'), _('Jun'),
35 _('Jul'), _('Aug'), _('Sep'), _('Oct'), _('Nov'), _('Dec')],
36 dayNames: [_('Sunday'), _('Monday'), _('Tuesday'), _('Wednesday'), _('Thursday'), _('Friday'), _('Saturday')],
37 dayNamesShort: [_('Sun'), _('Mon'), _('Tue'), _('Wed'), _('Thu'), _('Fri'), _('Sat')],
38 dayNamesMin: [_('Su'),_('Mo'),_('Tu'),_('We'),_('Th'),_('Fr'),_('Sa')],
40 dateFormat: '[% IF ( dateformat_us ) %]mm/dd/yy[% ELSIF ( dateformat_metric ) %]dd/mm/yy[% ELSE %]yy-mm-dd[% END %]',
41 firstDay: [% CalendarFirstDayOfWeek %],
42 isRTL: [% IF ( bidi ) %]true[% ELSE %]false[% END %],
43 showMonthAfterYear: false,
45 $.datepicker.setDefaults($.datepicker.regional['']);
48 $(document).ready(function(){
50 $.datepicker.setDefaults({
54 buttonImage: '[% interface %]/lib/famfamfam/silk/calendar.png',
55 buttonImageOnly: true,
56 showButtonPanel: true,
60 $( ".datepicker" ).datepicker();
61 // http://jqueryui.com/demos/datepicker/#date-range
62 var dates = $( ".datepickerfrom, .datepickerto" ).datepicker({
65 onSelect: function( selectedDate ) {
66 var option = this.id == "from" ? "minDate" : "maxDate",
67 instance = $( this ).data( "datepicker" );
68 date = $.datepicker.parseDate(
69 instance.settings.dateFormat ||
70 $.datepicker._defaults.dateFormat,
71 selectedDate, instance.settings );
72 dates.not( this ).datepicker( "option", option, date );