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

Allow any timzone object keys for scheduler setValue #1472

Merged
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
20 changes: 8 additions & 12 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;
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 @@ -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