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

Commit

Permalink
Allow any timzone object keys for scheduler setValue
Browse files Browse the repository at this point in the history
Create jQuery selection string for timezone object
based on data-attributes and pass to selectlist
  • Loading branch information
interactivellama committed Aug 18, 2015
1 parent 64d280b commit 41f56d1
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions js/scheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,19 +458,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;
} 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 @@ -486,10 +484,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 41f56d1

Please sign in to comment.