Каталог файловtilda-conditional-form-1.0.js
901 902function t_form__conditionals_prepareDateFromDatePicker(inputElement) {903 var dateDivider = t_form__conditionals_getDateDivider(inputElement);904 905 var currentDate = inputElement.value.split(dateDivider);906 var dateFormat = inputElement.getAttribute('data-tilda-dateformat');907 if (currentDate != '') {908 if (dateFormat === 'DD-MM-YYYY') {909 return currentDate[2] + '-' + currentDate[1] + '-' + currentDate[0];910 }911 if (dateFormat === 'MM-DD-YYYY') {912
История файла и сравнение версий
return currentDate[2] + '-' + currentDate[0] + '-' + currentDate[1];
914 if (dateFormat === 'YYYY-MM-DD') { 915 return currentDate[0] + '-' + currentDate[1] + '-' + currentDate[2]; 921 * Проверяет аттрибут data-tilda-datediv и возвращает разделитель для даты 922 * @param {node} inputElement 925function t_form__conditionals_getDateDivider(inputElement) { 926 if (!inputElement) return; 928 var dateDividerType = inputElement.getAttribute('data-tilda-datediv'); 929 if (dateDividerType === 'dash' || !dateDividerType) { 932 if (dateDividerType === 'slash') { 935 if (dateDividerType === 'dot') { 941 * Сравнивает время в условиях 942 * @param {string} current время в поле с типом "Время" 943 * @param {string | [string, string]} target время в условии 944 * @param {ComparisonType} comparisonType 946 * - Возможнные варианты группы: time | time_btwn 947 * - Возможнные вараинты типа сравнения: 948 * - equals | not_equals | greater | less 951function t_form__conditionals_compareTime(current, target, comparisonType) { 952 var parsedType = t_form__conditionals_prepareComparisonType(comparisonType); 953 var group = parsedType.group; 954 var type = parsedType.type; 956 if (group.indexOf('btwn') !== -1 && !Array.isArray(target)) { 958 'Condition value must of type [string, string] when comparison type is range. Condition value is: ' + target 965 return current === target; 967 return Boolean(current) && current !== target; 969 return Boolean(current) && current > target; 971 return Boolean(current) && current < target; 973 return target[0] < current && current < target[1]; 975 throw new Error('Unknown comparison type when comparing time: ' + comparisonType); 980 * Сравнивает значения поля "Галочка" 981 * @param {string} current 982 * @param {ComparisonType} comparisonType 984 * - Возможнные варианты группы: cbox 985 * - Возможнные вараинты типа сравнения: 986 * - equals | not_equals | greater | less 989function t_form__conditionals_compareCheckbox(current, comparisonType) { 990 var type = t_form__conditionals_prepareComparisonType(comparisonType).type; 994 return Boolean(current); 995 case 'not_filled_in': 998 throw new Error('Unknown comparison type when comparing checkbox: ' + comparisonType);