fix(scheduler): Don't cast durations to integers, fix 1.5, 2.5 hour blocks

This commit is contained in:
Ben Gotow 2016-04-11 18:52:49 -07:00
parent 5f75cccc0f
commit c69b192881

View file

@ -97,7 +97,7 @@ class ProposedTimeCalendarStore extends NylasStore {
) )
const blockSize = this._duration.slice(0, 2) const blockSize = this._duration.slice(0, 2)
blockSize[0] = parseInt(blockSize[0], 10); blockSize[0] = blockSize[0] / 1; // moment requires a number
const isMinBlockSize = (bounds.end - bounds.start) >= moment.duration.apply(moment, blockSize).as('seconds'); const isMinBlockSize = (bounds.end - bounds.start) >= moment.duration.apply(moment, blockSize).as('seconds');
while (minMoment.isSameOrBefore(maxMoment)) { while (minMoment.isSameOrBefore(maxMoment)) {
const start = minMoment.unix(); const start = minMoment.unix();
@ -138,9 +138,11 @@ class ProposedTimeCalendarStore extends NylasStore {
} }
_onEndBlock = () => { _onEndBlock = () => {
this._convertBufferToProposedTimes() if (this._dragBuffer.anchor) {
this._resetDragBuffer(); this._convertBufferToProposedTimes()
this.trigger() this._resetDragBuffer();
this.trigger();
}
} }
_onChangeDuration = (newDuration) => { _onChangeDuration = (newDuration) => {