app/assets/javascripts/will_pickdate.js in will_pickdate-0.9.1 vs app/assets/javascripts/will_pickdate.js in will_pickdate-0.9.2
- old
+ new
@@ -91,9 +91,24 @@
.css('display', this.display)
.val(init_clone_val);
this.element.before(this.clone);
+ // hook original datetime input for change events, in hope of making it easy for developers to
+ // do something in lines of:
+ // $('#event_starts_at').change(function(e){ $('#event_ends_at').val(this.value).change() })
+ // in order to control through outside behaviours the value and display value of the calendar widget
+ this.element.change($.proxy(function(e) {
+ this.clone.val(
+ this.format(
+ new Date(
+ this.unformat(
+ this.element.val(),
+ this.options.inputOutputFormat)
+ ),
+ this.options.format));
+ }, this));
+
if(this.toggler) {
this.toggler.css('cursor', 'pointer').click($.proxy(function(event) {
this.onFocus(this.element, this.clone);
}, this));
\ No newline at end of file