Background: I'm trying to have 2-3 tabs which the user can select from (in an HTML page). The first tab is based on the sniffed language of the browser, and the user will have the possibility to also pick English or Norwegian.
Technical part: I create three calendars $('#datetimepicker*LANGUAGE*')
,
$(function() {
$('#datetimepickerEN').datetimepicker({
format: 'YYYY-MM-DD HH:mm',
formatTime: 'HH:mm',
step:15,
startDate: moment().toDate(),
minDate: moment().toDate(),
maxDate: moment().add(20, "days").toDate(),
});
$.datetimepicker.setDateFormatter({
parseDate: function(date, format) {
var d = moment(date, format);
return d.isValid() ? d.toDate() : false;
},
formatDate: function(date, format) {
return moment(date).format(format);
},
});
});$(function() {
$('#datetimepickerPL').datetimepicker({
format: 'YYYY-MM-DD HH:mm',
formatTime: 'HH:mm',
step:15,
startDate: moment().toDate(),
minDate: moment().toDate(),
maxDate: moment().add(20, "days").toDate(),
});
$.datetimepicker.setDateFormatter({
parseDate: function(date, format) {
var d = moment(date, format);
return d.isValid() ? d.toDate() : false;
},
formatDate: function(date, format) {
return moment(date).format(format);
},
});
});
$.datetimepicker.setLocale('pl');
each attached to its correspondig input element
<input type="text" autocomplete="off" name="date" id="datetimepicker*LANGUAGE*" />
but upon setting the language, for example
$.datetimepicker.setLocale('pl');
the language of all three calendars are changed, which is logical because apparently I set the langue of only one instance $.datetimepicker
. The question is now as to how I can address this issue. Do I need 3 different instances? (if yes, how?)