diff --git a/README.md b/README.md index 496b952..47486c1 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,7 @@ Currently the following languages are supported - pt-BR - ru-RU - sv-SE +- uk-UA You can set the current language with: diff --git a/Source/Locale.uk-UA.DatePicker.js b/Source/Locale.uk-UA.DatePicker.js new file mode 100644 index 0000000..3cabd41 --- /dev/null +++ b/Source/Locale.uk-UA.DatePicker.js @@ -0,0 +1,19 @@ +/* +--- +name: Locale.en-US.DatePicker +description: English Language File for DatePicker +authors: Arian Stolwijk +requires: [More/Locale] +provides: Locale.en-US.DatePicker +... +*/ + + +Locale.define('uk-UA', 'DatePicker', { + select_a_time: 'Встановіть час', + use_mouse_wheel: 'Використовуйте прокрутку для швидкої зміни значення', + time_confirm_button: 'Гаразд', + apply_range: 'Застосувати', + cancel: 'Скасувати', + week: 'Т-нь' +}); diff --git a/Source/Picker.Date.js b/Source/Picker.Date.js index 8b4558e..fbc9fb9 100644 --- a/Source/Picker.Date.js +++ b/Source/Picker.Date.js @@ -42,6 +42,7 @@ this.DatePicker = Picker.Date = new Class({ updateAll : false, //whether or not to update all inputs when selecting a date weeknumbers: false, + weekdays: null, // if you like to use your own translations months_abbr: null, @@ -608,9 +609,12 @@ var isUnavailable = function(type, date, options){ var minDate = options.minDate, maxDate = options.maxDate, availableDates = options.availableDates, + weekdays = options.weekdays, year, month, day, ms; - - if (!minDate && !maxDate && !availableDates) return false; + if ( typeof avaliableDates == 'undefined' ) { + availableDates = null; + } + if (!minDate && !maxDate && !availableDates && !weekdays) return false; date.clearTime(); if (type == 'year'){ @@ -653,8 +657,12 @@ var isUnavailable = function(type, date, options){ year = date.get('year'); month = date.get('month') + 1; day = date.get('date'); + weekday = date.getDay(); var dateAllow = (minDate && date < minDate) || (maxDate && date > maxDate); + if ( weekdays !== null ) { + dateAllow = dateAllow || !weekdays.contains(weekday); + } if (availableDates != null){ dateAllow = dateAllow || availableDates[year] == null