The best way that I could find to do this is to use a for
loop. For your specific example of events from 1pm to 5pm from Aug 12th to the 15th, you could create a for
loop similar to this one:
var events = [];
for (var i = 0; i < 4; i++) {
events.push({
content: 'Repeating Event',
endDate: new Date(2014, 7, 12 + i, 17),
startDate: new Date(2014, 7, 12 + i, 13)
});
}
new Y.Scheduler({
// ...
date: new Date(2014, 7, 11),
items: events,
render: true
// ...
});
Here's a full example with a runnable AlloyUI Scheduler
(scroll down to see the events that start at 1pm):
YUI().use('aui-scheduler', function (Y) {
var events = [];
for (var i = 0; i < 4; i++) {
events.push({
content: 'Repeating Event',
endDate: new Date(2014, 7, 12 + i, 17),
startDate: new Date(2014, 7, 12 + i, 13)
});
}
new Y.Scheduler({
boundingBox: '#boundingBox',
date: new Date(2014, 7, 10),
items: events,
render: true,
views: [new Y.SchedulerWeekView()]
});
});
<script src="https://cdn.rawgit.com/stiemannkj1/701826667a70997013605edcd37e92a6/raw/469fe1ae297e72a5a80eb9015003b7b04eac735e/alloy-ui-3.0.1_aui_aui-min.js"></script>
<link href="https://cdn.rawgit.com/stiemannkj1/90be22de7f48c729b443af14796d91d3/raw/a9f35ceedfac7fc0559b121bed105eaf80f10bf2/aui-css_css_bootstrap.min.css" rel="stylesheet"></link>
<div id="boundingBox"></div>
If this solution is not good enough, you may want to check out the Scheduler
API docs. SchedulerEvent
has a repeated
attribute that may be what you are looking for (Note: I could not get the repeated
attribute to work in the way that I expected for your use case).