nazar-pc / PickMeUp

Really simple, powerful, customizable and lightweight standalone datepicker
BSD Zero Clause License
616 stars 191 forks source link

Initial commit for new mode "mixed" #229

Open s-peryt opened 4 years ago

s-peryt commented 4 years ago

Reason for this patch My use-case required to have mode where I can easily and quickly select multiple ranges of dates and individual dates, e.g. 12 October till 15 October, 20 October, 28 October till 30 October. Since I couldn't find any good way for this I added such feature myself.

Current state It is a bit rough in some places but base functionality is working for me, so I've decided to share it and maybe start discussion how this mode can be improved and pushed to main repository. Probably it will also help others in their use-cases. Please keep in mind I am not JS expert and most likely there few things that can be improved.

Known areas for improvement

  1. Only adding dates works and there is no to remove them. Plan is to allow user to delete dates by clicking while holding a key down. This requires a bit more logic to be developed to split ranges.

  2. There is a high chance of duplicates of dates happening. Some duplicates reduction should be added.

nazar-pc commented 4 years ago

This looks interesting and potentially useful. I think you can actually hack similar functionality multiple mode rather easily by observing how selected dates change. As to the name mixed is vary vague, something like multi-range would be nicer.

I'm only passively maintaining this library, since I'm not using it myself for many years now (mostly doing backend these days). So unless you can finish it and make it such that I can just click merge, chances of me getting back to it and finishing are pretty small.