react-compound-slider icon indicating copy to clipboard operation
react-compound-slider copied to clipboard

Treating slider steps with different values

Open rivella50 opened this issue 4 years ago • 5 comments

Hi there,

i'm just wondering how i can create a slider with a step interval which does not always have the same value? For instance a date slider where the single steps should be months. Since not all months have the same amount of days the step value cannot be a certain value of millis if each slider movement would have to match the last day of each month. Is there a solution for such a scenario or would i have to deal with it by myself (e.g. determine the last day of a month by the received ms in the onUpdate/onChange callbacks) ?

rivella50 avatar May 21 '20 13:05 rivella50

There's an example of a dateslider in the readme. It uses date-fn and d3-scale's scaleTime to create the tics.

https://codesandbox.io/s/rw97j317p

RanSolo avatar May 27 '20 16:05 RanSolo

I know that example. But here the step interval is always the same (half an hour) which doesn't answer my question.

rivella50 avatar May 27 '20 17:05 rivella50

Well you were talking about months being a different number of days, not changing the minute intervals.

RanSolo avatar Jun 08 '20 12:06 RanSolo

Has anyone figured it out?

gitp2p avatar Jun 11 '20 12:06 gitp2p

Nope, i solved it differently with a step interval of a day (which has of course always the same amount of millis). @RanSolo Please read again my initial question. I was never talking about minute intervals.

rivella50 avatar Jun 11 '20 12:06 rivella50