Skip to main content
zizii22429128
Participating Frequently
Aug 14, 2017 7:55 AM UTC
Answered

Time sheet

Hello, greeting from Indonesia

Im new for javascript, im trying make timesheet for daily planner. The first day is monday. I want to make  pdf automatically fill the first date for next monday. example: now is monday 8/14/2017, the date fill with this date, but if i make timesheet tomorrow, (tuesday 8/15/2017) the first date will show next monday date (8/21/2017). Could you help me. Thank you and im sorry my english is terrible. Thanks

This topic is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Aug 14, 2017 11:35 AM UTC

im sorrry, i make timesheet for pdf intearctive, thanks


OK. Let's say the field is called "Monday". Go to Tools - JavaScript - Document JavaScripts, create a new item (let's call it "scripts"), and then paste this code into it (delete any pre-existing code that is generated there):

var d = new Date();

while (d.getDay()!=1) d.setDate(d.getDate()+1);

this.getField("Monday").value = util.printd("mm/dd/yyyy", d);

11 replies

try67
Community Expert
Community Expert
Aug 14, 2017 8:02 AM UTC

Your English is not terrible at all... It's actually very good. No need to apologize.

So when do you want the dates to update? When you open a file? When you click on a button in the file?

Translate
zizii22429128
Participating Frequently
Aug 14, 2017 10:51 AM UTC

try67​

Thank you for replying so fast....

Actually i want the dates update when the file opened, so no need to fill the date manually, thank you so much

Translate
zizii22429128
Participating Frequently
Aug 14, 2017 11:13 AM UTC

im sorrry, i make timesheet for pdf intearctive, thanks

Translate