Ho to all.
I was wondering how can I create a select with the date of the saturdays in the next four months, using jquery.ui as a reference for the date.
I just wanna create something like that:
<select>
<optgroup label="July">
<option value="30/07/2012">30</option>
</optgroup>
<optgroup label="August">
<option value="04/08/2012">4</option>
<option value="11/08/2012">11</option>
<option value="18/08/2012">18</option>
<option value="25/08/2012">25</option>
</optgroup>
</select>
…
Any help will be strongly appreciated.
Thank you so much for the attention.
As soon as you start doing any sort of date math, you should always evaluate the leading date libraries out there. jQUeryUI’s date functionality is centered around the needs of the datepicker and, while awesome, if you don’t need the actual date picker then you may be better off using something like Moment.js
To find the next several saturdays with Moment, you can do something like:
And on JSFiddle