Fix ukrainian short day names

This commit is contained in:
Lev Lukomskyi 2019-11-15 22:47:38 +02:00
parent 82a256409f
commit 58174a023d

View File

@ -80,7 +80,7 @@ var datetimepickerFactory = function ($) {
'Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень' 'Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'
], ],
dayOfWeekShort: [ dayOfWeekShort: [
"Ндл", "Пнд", "Втр", "Срд", "Чтв", "Птн", "Сбт" "Нд", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"
], ],
dayOfWeek: ["Неділя", "Понеділок", "Вівторок", "Середа", "Четвер", "П'ятниця", "Субота"] dayOfWeek: ["Неділя", "Понеділок", "Вівторок", "Середа", "Четвер", "П'ятниця", "Субота"]
}, },
@ -667,7 +667,7 @@ var datetimepickerFactory = function ($) {
parseDate: function (date, format) { parseDate: function (date, format) {
if(isFormatStandard(format)){ if(isFormatStandard(format)){
return defaultDateHelper.parseDate(date, format); return defaultDateHelper.parseDate(date, format);
} }
var d = moment(date, format); var d = moment(date, format);
return d.isValid() ? d.toDate() : false; return d.isValid() ? d.toDate() : false;
}, },
@ -675,7 +675,7 @@ var datetimepickerFactory = function ($) {
formatDate: function (date, format) { formatDate: function (date, format) {
if(isFormatStandard(format)){ if(isFormatStandard(format)){
return defaultDateHelper.formatDate(date, format); return defaultDateHelper.formatDate(date, format);
} }
return moment(date).format(format); return moment(date).format(format);
}, },
@ -708,7 +708,7 @@ var datetimepickerFactory = function ($) {
if(typeof dateFormatter === 'string' && dateFormatters.hasOwnProperty(dateFormatter)){ if(typeof dateFormatter === 'string' && dateFormatters.hasOwnProperty(dateFormatter)){
var df = dateFormatters[dateFormatter]; var df = dateFormatters[dateFormatter];
$.extend(default_options, df.default_options); $.extend(default_options, df.default_options);
dateHelper = df.formatter; dateHelper = df.formatter;
} }
else { else {
dateHelper = dateFormatter; dateHelper = dateFormatter;
@ -1751,26 +1751,26 @@ var datetimepickerFactory = function ($) {
classes.push('xdsoft_disabled'); classes.push('xdsoft_disabled');
} }
} }
if(options.allowDates && options.allowDates.length>0){ if(options.allowDates && options.allowDates.length>0){
if(options.allowDates.indexOf(dateHelper.formatDate(start, options.formatDate)) === -1){ if(options.allowDates.indexOf(dateHelper.formatDate(start, options.formatDate)) === -1){
classes.push('xdsoft_disabled'); classes.push('xdsoft_disabled');
} }
} }
var currentDay = ((start.getFullYear() * 12) + start.getMonth()) * 31 + start.getDate(); var currentDay = ((start.getFullYear() * 12) + start.getMonth()) * 31 + start.getDate();
if ((maxDate !== false && start > maxDate) || (minDateTime !== false && start < minDateTime) || (minDate !== false && start < minDate) || (maxDateTime !== false && currentDay > maxDateTimeDay) || (customDateSettings && customDateSettings[0] === false)) { if ((maxDate !== false && start > maxDate) || (minDateTime !== false && start < minDateTime) || (minDate !== false && start < minDate) || (maxDateTime !== false && currentDay > maxDateTimeDay) || (customDateSettings && customDateSettings[0] === false)) {
classes.push('xdsoft_disabled'); classes.push('xdsoft_disabled');
} }
if (options.disabledDates.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) { if (options.disabledDates.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) {
classes.push('xdsoft_disabled'); classes.push('xdsoft_disabled');
} }
if (options.disabledWeekDays.indexOf(day) !== -1) { if (options.disabledWeekDays.indexOf(day) !== -1) {
classes.push('xdsoft_disabled'); classes.push('xdsoft_disabled');
} }
if (input.is('[disabled]')) { if (input.is('[disabled]')) {
classes.push('xdsoft_disabled'); classes.push('xdsoft_disabled');
} }
@ -2398,7 +2398,7 @@ var datetimepickerFactory = function ($) {
var valueBeforeCursor = val.substr(0, pos); var valueBeforeCursor = val.substr(0, pos);
var valueAfterPaste = val.substr(pos + pastedData.length); var valueAfterPaste = val.substr(pos + pastedData.length);
val = valueBeforeCursor + pastedData + valueAfterPaste; val = valueBeforeCursor + pastedData + valueAfterPaste;
pos += pastedData.length; pos += pastedData.length;
if (isValidValue(options.mask, val)) { if (isValidValue(options.mask, val)) {
@ -2424,7 +2424,7 @@ var datetimepickerFactory = function ($) {
// only alow these characters // only alow these characters
if (((key >= KEY0 && key <= KEY9) || if (((key >= KEY0 && key <= KEY9) ||
(key >= _KEY0 && key <= _KEY9)) || (key >= _KEY0 && key <= _KEY9)) ||
(key === BACKSPACE || key === DEL)) { (key === BACKSPACE || key === DEL)) {
// get char to insert which is new character or placeholder ('_') // get char to insert which is new character or placeholder ('_')
@ -2455,7 +2455,7 @@ var datetimepickerFactory = function ($) {
pos += (key === BACKSPACE && !hasSel) ? -1 : 1; pos += (key === BACKSPACE && !hasSel) ? -1 : 1;
} }
if (event.metaKey) { // cmd has been pressed if (event.metaKey) { // cmd has been pressed
pos = 0; pos = 0;
hasSel = true; hasSel = true;
@ -2467,7 +2467,7 @@ var datetimepickerFactory = function ($) {
// if we have a selection length we will wipe out entire selection and replace with default template for that range // if we have a selection length we will wipe out entire selection and replace with default template for that range
var defaultBlank = options.mask.replace(/[0-9]/g, '_'); var defaultBlank = options.mask.replace(/[0-9]/g, '_');
var defaultBlankSelectionReplacement = defaultBlank.substr(pos, selLength); var defaultBlankSelectionReplacement = defaultBlank.substr(pos, selLength);
var selReplacementRemainder = defaultBlankSelectionReplacement.substr(1) // might be empty var selReplacementRemainder = defaultBlankSelectionReplacement.substr(1) // might be empty
var valueBeforeSel = val.substr(0, pos); var valueBeforeSel = val.substr(0, pos);