Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I somehow made it work by writing my own library. This is just the instance of code you need to include for changing or converting the date coming from the server side JSON schema.</p> <p>Code:</p> <pre><code>cacheElements: function() { this.$datePickers = this.$el.find('.datepicker'); this.$datePickerStart = this.$datePickers.filter('.start'); this.$datePickerEnd = this.$datePickers.filter('.end'); this.$loader = this.$el.find('.timeframe-loader'); }, render: function() { this.$el.html(this.template(this.model)); this.cacheElements(); this.$datePickers.datepicker({ dateFormat: 'dd.mm.yy' }); this.delegateEvents(); return this; }, _onError: function(model, error) { this._hideLoader(); var $where; if (error.where == 'startDate') { $where = this.$datePickerStart.closest('div'); } else if (error.where == 'endDate') { $where = this.$datePickerEnd.closest('div'); } new Tooltip.View({ srcElement: $where, content: error.message, position: 'bottom' }); }, _onClickSendData: function() { var start = this.$datePickerStart.val(); var end = this.$datePickerEnd.val(); var startDate = humanDateStringToJSDateString(start); var endDate = humanDateStringToJSDateString(end); // If didn't actually change, do nothing: var modelStartDate = this.model.get('startDate'); var modelEndDate = this.model.get('endDate'); if (this._compareYYYMMDD(new Date(startDate), modelStartDate) !== 0 || this._compareYYYMMDD(new Date(endDate), modelEndDate) !== 0) { this._showLoader(); this.model.set({ startDate: new Date(startDate), endDate: new Date(endDate) }); } }, _compareYYYMMDD: function(date1, date2) { var num1 = dateToString(date1).replace('-',''); var num2 = dateToString(date2).replace('-',''); return date1 - date2; }, _showLoader: function() { this.$loader.show(); }, _hideLoader: function() { this.$loader.hide(); }, setEndDate: function() { this.$datePickerStart.val(dateToDottedString(addDays(new Date(), - App.state.get('timeframe')))); this.$datePickerEnd.val(dateToDottedString(new Date())); } </code></pre> <p>});</p> <p>Let me know if you have difficulty in understanding the logic! </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload