$(document).ready -> cb = (start, end, label) -> console.log start.toISOString(), end.toISOString(), label $('#reportrange span').html start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY') #alert("Callback has fired: [" + start.format('MMMM D, YYYY') + " to " + end.format('MMMM D, YYYY') + ", label = " + label + "]"); return optionSet1 = startDate: moment().subtract(29, 'days') endDate: moment() minDate: '01/01/2012' maxDate: '12/31/2015' dateLimit: days: 60 showDropdowns: true showWeekNumbers: true timePicker: false timePickerIncrement: 1 timePicker12Hour: true ranges: 'Today': [ moment() moment() ] 'Yesterday': [ moment().subtract(1, 'days') moment().subtract(1, 'days') ] 'Last 7 Days': [ moment().subtract(6, 'days') moment() ] 'Last 30 Days': [ moment().subtract(29, 'days') moment() ] 'This Month': [ moment().startOf('month') moment().endOf('month') ] 'Last Month': [ moment().subtract(1, 'month').startOf('month') moment().subtract(1, 'month').endOf('month') ] opens: 'left' buttonClasses: [ 'btn btn-default' ] applyClass: 'btn-small btn-primary' cancelClass: 'btn-small' format: 'MM/DD/YYYY' separator: ' to ' locale: applyLabel: 'Submit' cancelLabel: 'Clear' fromLabel: 'From' toLabel: 'To' customRangeLabel: 'Custom' daysOfWeek: [ 'Su' 'Mo' 'Tu' 'We' 'Th' 'Fr' 'Sa' ] monthNames: [ 'January' 'February' 'March' 'April' 'May' 'June' 'July' 'August' 'September' 'October' 'November' 'December' ] firstDay: 1 $('#reportrange span').html moment().subtract(29, 'days').format('MMMM D, YYYY') + ' - ' + moment().format('MMMM D, YYYY') $('#reportrange').daterangepicker optionSet1, cb $('#reportrange').on 'show.daterangepicker', -> console.log 'show event fired' return $('#reportrange').on 'hide.daterangepicker', -> console.log 'hide event fired' return $('#reportrange').on 'apply.daterangepicker', (ev, picker) -> console.log 'apply event fired, start/end dates are ' + picker.startDate.format('MMMM D, YYYY') + ' to ' + picker.endDate.format('MMMM D, YYYY') return $('#reportrange').on 'cancel.daterangepicker', (ev, picker) -> console.log 'cancel event fired' return $('#options1').click -> $('#reportrange').data('daterangepicker').setOptions optionSet1, cb return $('#options2').click -> $('#reportrange').data('daterangepicker').setOptions optionSet2, cb return $('#destroy').click -> $('#reportrange').data('daterangepicker').remove() return return # --- # generated by js2coffee 2.1.0