Opened 6 years ago

Last modified 5 years ago

#8934 open bug

Spinner: Percentage functionality fails

Reported by: kvdeede Owned by:
Priority: minor Milestone: none
Component: ui.spinner Version: 1.9.2
Keywords: globalize Cc:
Blocked by: Blocking:


The spinner percentage functionality fails. From 0% it goes to 1% to 100% and afterwards it is impossible to go back to 0. When no maximum is set, it goes from 100% to 10.000% and it stays impossible to go back to a lower number. I made a jsFiddle project here:

I checked and have exactly the same problem on jsFiddle as I have on my local project.

Change History (6)

comment:1 Changed 6 years ago by tj.vantoll

Status: newopen
Summary: Percentage functionality spinner failsSpinner: Percentage functionality fails

Verified - I tried one with the US culture to make sure this wasn't just an issue with the culture file as well.

comment:2 Changed 6 years ago by tj.vantoll

This seems to be due the step value being coerced into a number before it is passed into Globalize.

For example if you want to use a step of '1%':

Globalize.format('1%', 'p', 'en-US') returns '1%'. However, by the time Globalize.format is invoked the step option is now a number, and Globalize.format(1, 'p', 'en-US') returns '100.00 %'.

comment:3 Changed 6 years ago by kvdeede

Note that a similar thing happens when you use a step of 0.01. It goes from 0% to 1% to 101% to 10,000%.

comment:4 Changed 6 years ago by tj.vantoll

Globalize.parseFloat is used to store the value of the step option when the spinner is created.

Globalize.parseFloat('1%', 10, 'en-US') => 1

Then when a step is done Globalize.format is used to determine what to display.

Globalize.format(1, 'p', 'en-US') => '100.00 %'

comment:5 Changed 6 years ago by tj.vantoll

Milestone: 1.10.0none

comment:6 Changed 5 years ago by Scott González

Keywords: globalize added
Note: See TracTickets for help on using tickets.