TimePicki icon indicating copy to clipboard operation
TimePicki copied to clipboard

Wrong format of minutes when 24hours format is used

Open martinbayer opened this issue 9 years ago • 4 comments

Hi, when I'm trying to user 24hours format and insert 0-9 minutes, it is not formatted correctly. E.g for 23:02, the result is 23:2. I guess the problem is in timepicki.js on line https://github.com/senthilraj/TimePicki/blob/master/js/timepicki.js#L37 as it ruins previously prepared value for values lower than 10.

martinbayer avatar Apr 27 '17 13:04 martinbayer

Same problem. Have you solved it?

Rogue85 avatar Apr 30 '17 09:04 Rogue85

I'm using downloaded library in my project, so I just removed line https://github.com/senthilraj/TimePicki/blob/master/js/timepicki.js#L37 I quickly analyzed the code and I think it is OK without this line...just give it a try...

martinbayer avatar May 01 '17 09:05 martinbayer

Martin is absolutely correct, removing line 37 was the fix I was coming here to suggest. From a quick assessment of the code, it seems this line should not be there at all, it simply overrides the string modification on the previous few lines causing the picker to display the wrong format for minutes.

For the record, the line to be remove should read: mini = Math.min(Math.max(parseInt(mini), 0), 59);

Spambanjo avatar May 08 '17 14:05 Spambanjo

Martin solved the puzzle!

gcalabria avatar Dec 04 '17 23:12 gcalabria