Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1472 from interactivellama/scheduler-setValue-tim…
Browse files Browse the repository at this point in the history
…ezone

Allow any timzone object keys for scheduler setValue
  • Loading branch information
interactivellama committed Aug 19, 2015
2 parents 4d2c2a9 + 7451f86 commit e391532
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions js/scheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,19 +455,17 @@
startDate = currentDate.getFullYear() + '-' + currentDate.getMonth() + '-' + currentDate.getDate();
}

item = 'li[data';
// create jQuery selection string for timezone object
// based on data-attributes and pass to selectlist
item = 'li';
if (options.timeZone) {
if (typeof (options.timeZone) === 'string') {
item += '-name="' + options.timeZone;
item += '[data-name="' + options.timeZone + '"]';
} else {
if (options.timeZone.name) {
item += '-name="' + options.timeZone.name;
} else {
item += '-offset="' + options.timeZone.offset;
}
$.each(options.timeZone, function(key, value) {
item += '[data-' + key + '="' + value + '"]';
});
}

item += '"]';
timeOffset = options.timeZone.offset;
this.$timeZone.selectlist('selectBySelector', item);
} else if (options.startDateTime) {
Expand All @@ -483,10 +481,8 @@
} else {
temp = '+00:00';
}

timeOffset = (temp === '+00:00') ? 'Z' : temp;

item += '-offset="' + temp + '"]';
item += '[data-offset="' + temp + '"]';
this.$timeZone.selectlist('selectBySelector', item);
} else {
timeOffset = 'Z';
Expand Down

0 comments on commit e391532

Please sign in to comment.