Using + in front of dates will convert them to milliseconds. In the demo this approach is used to more easily compare dates and comparing milliseconds is precise. As for attaching a template dynamically indeed setOptions is the way.