EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: ahybits on February 22, 2018, 09:36:17 AM



Title: Slider Hours of Day increment of .5 doesnt work
Post by: ahybits on February 22, 2018, 09:36:17 AM
I have this slider that does a range of time thought the day - works fine for each hour, but cant get .5 value so I can convert it to the half hour mark

https://jsfiddle.net/r3us9bkk/2/



Title: Re: Slider Hours of Day increment of .5 doesnt work
Post by: ahybits on February 23, 2018, 08:10:32 AM
I know in my jsfiddle i had increment - based on docs it should be step, either case it doeen't work for .5

It works for 1.5 but not .5 or 0.5

Other random values below 1 works --  .33 .75, .51, .4 all work
.5 and .25 doesnt


Title: Re: Slider Hours of Day increment of .5 doesnt work
Post by: jarry on February 23, 2018, 06:36:28 PM
Please try to use a newer version 1.5.4.2. It can be downloaded from https://www.jeasyui.com/download/v154.php


Title: Re: Slider Hours of Day increment of .5 doesnt work
Post by: ahybits on February 25, 2018, 09:39:54 AM
Awesome, works now; thanks


Title: Re: Slider Hours of Day increment of .5 doesnt work [solved]
Post by: ahybits on February 25, 2018, 11:19:13 AM
Just incase anyone needs it; here is the function i used for the time range in the slider

Code:
function convertToTimeFormat(value) {
        if (value==0) {
            value = '12:00am'
        } else if (value<1) {
            value = '12:30am'
        } else if (value==12) {
            value = '12:00pm'
        } else if (value>12 && value<13) {
            value = '12:30pm'
        } else if (value==24) {
            value = '11:59pm'
        } else if (value>=13) {
            value = value-12
            value += 'pm'
        } else {
            value += 'am'
        }
        if (value.indexOf('.5')) value=value.replace('.5',':30')
        return value
    }