Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minute Decrements Inconsistent with Increments #196

Open
drbenschmidt opened this issue Jan 9, 2014 · 2 comments
Open

Minute Decrements Inconsistent with Increments #196

drbenschmidt opened this issue Jan 9, 2014 · 2 comments
Labels

Comments

@drbenschmidt
Copy link

When the user increments the minute value, it will jump to the nearest multiple of the minuteStep, but not for decrements. I'm not sure this is correct behavior, but if it isn't, here's a suggested fix (although it's not as elegant as the increment code):

    var newVal;
    if((this.minute - this.minuteStep) % this.minuteStep != 0) {
        if(this.minute - this.minuteStep < 0) {
            newVal = 0;
        } else {
            newVal = this.minute - ((this.minute - this.minuteStep) % this.minuteStep);
        }
    } else {
         newVal = this.minute - this.minuteStep;
    }
@mmrenomeron
Copy link

Is there a fix for this issue? Here's my scenario:

  1. minute value = 12 with minuteStep = 5
  2. Clicked on arrow down. This will give me 07, then 02 after clicking it again.
  3. Clicked on arrow up. This will give me 10, then after clicking it again will give me 15.

Why did it changed to the nearest multiple after clicking arrow up instead of

current value + minuteStep

@mrhota mrhota added the bug label Jul 30, 2015
@cyberatom3000
Copy link

When the user increments the minute value, it will jump to the nearest multiple of the minuteStep, but not for decrements. I'm not sure this is correct behavior, but if it isn't, here's a suggested fix (although it's not as elegant as the increment code):

    var newVal;
    if((this.minute - this.minuteStep) % this.minuteStep != 0) {
        if(this.minute - this.minuteStep < 0) {
            newVal = 0;
        } else {
            newVal = this.minute - ((this.minute - this.minuteStep) % this.minuteStep);
        }
    } else {
         newVal = this.minute - this.minuteStep;
    }

I'm using this timepicker for a Yii2 project where do i do the suggested changes..?

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

No branches or pull requests

4 participants