| Server IP : 185.252.147.100 / Your IP : 216.73.217.33 Web Server : nginx/1.27.3 System : Linux mitrofanov.ru 6.1.0-37-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.140-1 (2025-05-22) x86_64 User : mitr ( 1000) PHP Version : 8.2.29 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/html/tour.mitrofanov.ru/public/wp-content/plugins/tour-addons/js/ |
Upload File : |
//window.addEventListener('load', function() {
const picker = new easepick.create({
//element: document.getElementById('html-1'),
element: document.querySelector('input[name=text-1]'),
css: [
'/wp-content/plugins/tour-addons/css/easepick.min.css',
],
setup(picker) {
picker.on('select', (e) => {
const {
start,
end
} = e.detail,
elem = document.querySelector('input[name=text-1]');
elem.value = "";
//console.log('elem ', elem.value);
// do something
//console.log('zz', start.toLocaleDateString('ru-RU'));
let Difference_In_Time =
end.getTime() - start.getTime();
let Difference_In_Days =
Math.round
(Difference_In_Time / (1000 * 3600 * 24));
//console.log (Difference_In_Days + " days");
const enOrdinalRules = new Intl.PluralRules("ru-RU");
const suffixes = new Map([
["one", "ночь"],
["two", "ночи"],
["few", "ночи"],
["many", "ночей"],
]);
const formatOrdinals = (n) => {
const rule = enOrdinalRules.select(n);
const suffix = suffixes.get(rule);
return `${n} ${suffix}`;
};
//console.log(formatOrdinals(Difference_In_Days));
elem.value = start.toLocaleDateString('ru-RU') + " - " + end.toLocaleDateString('ru-RU') + " (" + formatOrdinals(Difference_In_Days) + ")";
});
},
lang: "ru-RU",
grid: 2,
calendars: 2,
inline: true,
plugins: ['RangePlugin', 'LockPlugin'],
RangePlugin: {
tooltipNumber(num) {
return num - 1;
},
locale: {
one: 'ночь',
few: 'ночи',
many: 'ночей',
},
},
LockPlugin: {
minDate: new Date(),
minDays: 2,
}
});
//})