angular-ui / ui-slider

jQuery UI Slider for AngularJS
https://htmlpreview.github.io/?https://github.com/angular-ui/ui-slider/master/demo/index.html
MIT License
265 stars 176 forks source link

Feature, use dates? #96

Open jlaustill opened 8 years ago

jlaustill commented 8 years ago

I've been looking through your script, and it seems like it would be possible to extend it fairly easily to use dates in this slider. Is this something you would be interesting in adding? I use a jqueryui slider on a dashboard to adjust a range of dates, it works pretty slick and users love it. In my use case, I simply convert the date to days and start at zero, so if the dates are 2000/1/1 and 2001/1/1, 2000/1/1 becomes 0, and 2001/1/1 would be 365. Upon slide change I convert the days and add it back to the dates.

It seems like I should be able to do this in a more dynamic, reusable way by having an option for useDates that takes a parameter of the date step to use, like day, second, minute, month, etc. Then the step value could be a multiplier for that step. Example

So in this case it would convert dates to ms since the beginDate, then step by 1000ms. My only real concern with this is that I use momentjs to do all of my date calculations, and I'm not sure that it would be wise to try to do all that fancy date stuff in javascript. Maybe it would be possible to make it work without momentjs unless the dates option was set? I dunno, I'm sort of brainstorming here. Let me know your thoughts, I'm not opposed to forking and doing the work, I just don't wanna start something that there are very good reasons not to do that I'm just not aware of. Like, if that ability already exists somewhere else :)

Have a great day, I look forward to your thoughts!