javascript - Suggestions for dynamic dates/events on a HTML site -


i volunteer animal rescue group , our web site strictly html site jquery.

i'm looking suggestions on how make bit more dynamic don't have figure out when next adopt-a-pet event be. on 2nd , 4th saturday of each month. information, expect implore little javascript/jquery magic , produce html code, dynamically.

<article class="event-holder">     <h4><a class="more-heading" href="aap.html">adopt pet</a></h4>     <p>meet our cats available adoption on june 26th... <a class="read-more" href="aap.html">more</a></p>     </article> 

given code sample above, date of june 26th dynamic variable. thing i'm not sure start.

if can this, i'd appreciate it.

this seems work me:

var nextsaturday = new date(); var months = ['january','february','march','april','may','june','july','august','september','october','november','december'];  var stopper = true;  while(stopper){     var x = nextsaturday.getdate();      if(nextsaturday.getday() == 6 && ((x > 7 && x < 15) || (x > 21 && x < 29))){         stopper = false;     } else {         nextsaturday.setdate(x + 1);     } }  console.log("next 2nd or 4th saturday " + months[nextsaturday.getmonth()] + " " + nextsaturday.getdate()); 

as far tested it, worked, date junk weird.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -