Skip to content

Conversation

smistir
Copy link

@smistir smistir commented Jan 13, 2016

Updated bootstrap-timepicker.js to add functionality to round to the next step during decrement when the initial value is not a multiple of the step (similar to incrementMinute). During the call to decrementMinute, when the value is '02' and step is '15', the new value will become '00' and further decrements will following the step (02 -> 00 -> 45 -> 30).

incrementMinute follows this same behavior already (02 -> 15 -> 30 -> 45).

Added UnitTest test cases to test this scenario (for both incrementMinute and decrementMinute).

Updated decrementMinute to behave similar to incrementMinute such that decrement will first round down if current value is not a multiple of this.minuteStep.

**incrementMinute will apply the increment and then remove the remaining so that the new value is the next-step up (this.minute==2 with increment applied will result in "15" with a this.minuteStep==15).

Previous implementation would not round decrement (this.minute==2 and this.minuteStep==15 will result in the minute becoming "47" instead of "0".
Added UnitTest test-cases to test when the initial value is not a Multiple of the step for incrementMinute and decrementMinute
@smistir smistir changed the title Patch 1 decrementMinute - added round to next step for when initial value is not a multiple of the step. Jan 13, 2016
fixed formatting issues within the file
@mrhota
Copy link
Collaborator

mrhota commented Mar 18, 2016

@smistir thank you for this! Sorry for the wait. I'll be merging some PRs soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants