From b913c66ab8bc7e7cd6a6fd5c1b6845ddd7d6a3a7 Mon Sep 17 00:00:00 2001 From: Bob Janes Date: Sun, 26 Aug 2012 12:38:33 +0200 Subject: [PATCH 1/2] Re-commit UA update --- README.md | 1 + Source/Locale.uk-UA.DatePicker.js | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 Source/Locale.uk-UA.DatePicker.js 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: 'Т-нь' +}); From dd46c62396623c1aaa3cbfd822c513036584db03 Mon Sep 17 00:00:00 2001 From: Bob Janes Date: Sun, 26 Aug 2012 12:56:42 +0200 Subject: [PATCH 2/2] Add option to enable only specified weekdays Added a new option 'weekdays' that takes an optional array of day numbers e.g. {0,3,4}. If the array is present then the available dates are limited to the days in the array. The option is applied in the isUnavailable() function when the calendar is rendered. --- Source/Picker.Date.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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