Lines 18-40
Link Here
|
18 |
var calendarFirstDayOfWeek = '[% Koha.Preference('CalendarFirstDayOfWeek') | html %]'; |
18 |
var calendarFirstDayOfWeek = '[% Koha.Preference('CalendarFirstDayOfWeek') | html %]'; |
19 |
var flatpickr_timeformat_string = [% IF Koha.Preference('TimeFormat') == '12hr' %]"G:i K"[% ELSE %]"H:i"[% END %]; |
19 |
var flatpickr_timeformat_string = [% IF Koha.Preference('TimeFormat') == '12hr' %]"G:i K"[% ELSE %]"H:i"[% END %]; |
20 |
var flatpickr_timeformat = [% IF Koha.Preference('TimeFormat') == '12hr' %]false[% ELSE %]true[% END %]; |
20 |
var flatpickr_timeformat = [% IF Koha.Preference('TimeFormat') == '12hr' %]false[% ELSE %]true[% END %]; |
21 |
var dateformat_string = ""; |
|
|
22 |
var flatpickr_dateformat_string = ""; |
21 |
var flatpickr_dateformat_string = ""; |
23 |
switch ( dateformat_pref ){ |
22 |
switch ( dateformat_pref ){ |
24 |
case "us": |
23 |
case "us": |
25 |
dateformat_string = "mm/dd/yy"; |
|
|
26 |
flatpickr_dateformat_string = "m/d/Y"; |
24 |
flatpickr_dateformat_string = "m/d/Y"; |
27 |
break; |
25 |
break; |
28 |
case "metric": |
26 |
case "metric": |
29 |
dateformat_string = "dd/mm/yy"; |
|
|
30 |
flatpickr_dateformat_string = "d/m/Y"; |
27 |
flatpickr_dateformat_string = "d/m/Y"; |
31 |
break; |
28 |
break; |
32 |
case "dmydot": |
29 |
case "dmydot": |
33 |
dateformat_string = "dd.mm.yy"; |
|
|
34 |
flatpickr_dateformat_string = "d.m.Y"; |
30 |
flatpickr_dateformat_string = "d.m.Y"; |
35 |
break; |
31 |
break; |
36 |
default: |
32 |
default: |
37 |
dateformat_string = "yy-mm-dd"; |
|
|
38 |
flatpickr_dateformat_string = "Y-m-d"; |
33 |
flatpickr_dateformat_string = "Y-m-d"; |
39 |
} |
34 |
} |
40 |
</script> |
35 |
</script> |
Lines 94-112
Link Here
|
94 |
function is_valid_date(date) { |
89 |
function is_valid_date(date) { |
95 |
// An empty string is considered as a valid date for convenient reasons. |
90 |
// An empty string is considered as a valid date for convenient reasons. |
96 |
if (date === '') return 1; |
91 |
if (date === '') return 1; |
97 |
var dateformat = dateformat_string; |
92 |
var dateformat = flatpickr_dateformat_string; |
98 |
if (dateformat == 'us') { |
93 |
switch ( dateformat_pref ){ |
99 |
if (date.search(/^\d{2}\/\d{2}\/\d{4}($|\s)/) == -1) return 0; |
94 |
case "us": |
100 |
dateformat = 'mm/dd/yy'; |
95 |
flatpickr_dateformat_string = "m/d/Y"; |
101 |
} else if (dateformat == 'metric') { |
96 |
break; |
102 |
if (date.search(/^\d{2}\/\d{2}\/\d{4}($|\s)/) == -1) return 0; |
97 |
case "metric": |
103 |
dateformat = 'dd/mm/yy'; |
98 |
flatpickr_dateformat_string = "d/m/Y"; |
104 |
} else if (dateformat == 'iso') { |
99 |
break; |
105 |
if (date.search(/^\d{4}-\d{2}-\d{2}($|\s)/) == -1) return 0; |
100 |
case "dmydot": |
106 |
dateformat = 'yy-mm-dd'; |
101 |
flatpickr_dateformat_string = "d.m.Y"; |
107 |
} else if (dateformat == 'dmydot') { |
102 |
break; |
108 |
if (date.search(/^\d{2}\.\d{2}\.\d{4}($|\s)/) == -1) return 0; |
103 |
default: |
109 |
dateformat = 'dd.mm.yy'; |
104 |
flatpickr_dateformat_string = "Y-m-d"; |
110 |
} |
105 |
} |
111 |
try { |
106 |
try { |
112 |
flatpickr.parseDate(date, dateformat); |
107 |
flatpickr.parseDate(date, dateformat); |
113 |
- |
|
|