Default date field a specific day of week?


hi:

 

i done new hire packet, , our company's traditional first day on mondays , auto-populate "start date" field next monday after... of course want able changed different starting date (e.g. holidays, getting head start on new hires 2 weeks out, etc.).

 

example: if today tuesday, may 24, 2016, want default date auto-populate 5/30/2016 (the next monday)... since our company closed in honor of memorial day (may our fallen heroes rest in peace), want able manually change 5/31/2016 (and yes, i'm doing on day off).

 

can me huge favor , post code me since i'm no expert on coding (the relevant answer "getday()" , have no clue go there)? lot!

i suggest use button populate field if want able override automatic value.

this code should trick:

 

var day = 86400000; var d = new date(); var currentday = d.getday(); if (currentday==0) { // sunday     d.settime(d.gettime()+day); } else if (currentday>1) { // tuesday - saturday     d.settime(d.gettime()+day*(7-(currentday-1))); } this.getfield("start date").value = util.printd("mm/dd/yyyy", d); 


More discussions in JavaScript


adobe

Comments

Popular posts from this blog

Soustraire une selection

After Effects: could not find dvaeve_dialogs.txt

Illustrator cs6 "Invalid Serial Number"