From 41f56d15c670b1a706112dd3bdaa4f23f0bf0127 Mon Sep 17 00:00:00 2001 From: Stephen James Date: Tue, 18 Aug 2015 17:06:59 -0400 Subject: [PATCH] Allow any timzone object keys for scheduler setValue Create jQuery selection string for timezone object based on data-attributes and pass to selectlist --- js/scheduler.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/js/scheduler.js b/js/scheduler.js index 598da6c1a..e5048fa4c 100644 --- a/js/scheduler.js +++ b/js/scheduler.js @@ -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) { @@ -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';