Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weekdays #123

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
19 changes: 19 additions & 0 deletions Source/Locale.uk-UA.DatePicker.js
Original file line number Diff line number Diff line change
@@ -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: 'Т-нь'
});
12 changes: 10 additions & 2 deletions Source/Picker.Date.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this changed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I recall correctly it was there to remove a warning about an undefined value. But it is not in my current version so is probably not needed. I re-started with a clean fork after getting into a mess with this version.

date.clearTime();

if (type == 'year'){
Expand Down Expand Up @@ -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
Expand Down