Print Page | Close Window

Auto populating Date field -Feb. is an issue

Printed From: Foxit's Planet PDF Forum
Category: Lets Talk PDF
Forum Name: Beginners
Forum Description: This is for users new to PDF. Ask simple questions here.
Printed Date: 23 Jan 2019 at 9:28am
Software Version: Web Wiz Forums 11.10 -

Topic: Auto populating Date field -Feb. is an issue
Posted By: Brianwh
Subject: Auto populating Date field -Feb. is an issue
Date Posted: 13 Feb 2017 at 6:03pm
Thought I would repost here.
Hello All,

I have read a number of posts on several sites. Additionally have noted a number of knowledgeable folks supporting all the of the newb questions. I have visited some resource sites like adobe. and various forums like this one.
However I am still not able to glean the solution for the correct java script that will address correctly auto populating the  Month of February if 1.29 thru 1.31 is selected in the initial date field.
all other dating works correctly
Form has 3 date fields, I am trying to provide script that will allow my users to populate the first field and the 2nd and 3rd field will be dated 1 month later , naturally Feb. is an exception
the main script I have used to this point is
 // get value of field to update - field name is Text5
var sDate = this.getField('Text5').value;
// convert to date time object
// the fields format is mm/dd/yyyy
var oDate = util.scand('mm/dd/yyyy', sDate);
// get the parts of the date
var fFullYear = oDate.getFullYear(); // 4 digit year
var fMonth = oDate.getMonth(); // zero based month
var fDate = oDate.getDate(); // date of month
// increment the month
// create new date time object
var oNewDate = new Date(fFullYear, fMonth, fDate);
// set field value - field has no format
// formatting is applied by the printd method
event.value = util.printd('mm/dd/yyyy', oNewDate);
I have tried a couple others that I could share if needed, however the result of those scripts is the same...I can share the other variations of java scripts used in further posts.
Any assistance in creating the additional scripting needed would be Greatly appreciated.
Ps I have tried tweaking this with formula for adding or subtracting days but alas not doing it correctly.
Again Thank you in advance
Brian -

Posted By: Merlin
Date Posted: 14 Feb 2017 at 11:50am

You dreamed of, Joel made it for you!
dateExtended Library for Adobe Acrobat:

ENG : -
FRA : -

Posted By: Brianwh
Date Posted: 14 Feb 2017 at 8:34pm

Hello Merlin,

thank you for the great link.
It would seem that Joel has created nice piece of scripting.
Not sure how I would apply this to my document! Any suggestions

Posted By: Merlin
Date Posted: 14 Feb 2017 at 10:23pm
I not sure why february should more difficult to manage than any other 30 days month.
Add 30 days instead of one month...

ENG : -
FRA : -

Posted By: gkaiseril
Date Posted: 16 Feb 2017 at 6:52pm
February never has 30 or 31 dayS. Do you need to add one month or 30 days?

Only 4 months have 30 days.

Posted By: Brianwh
Date Posted: 16 Feb 2017 at 7:08pm
Gkaiseril thank you for weighing in. ( I have noted your input in other forums as well)
yes I understand that Feb. is different than any other month, even in a leap year.
and that some months have 30 days and others have 31 days.
I have set a form to populate the date placed in field 1 to 2 other fields with 30 days incremented.
naturally if the initial field has 31 days and the following month on has 30
or if Jan 30 is selected then the following date will not be Feb. (xx)
this is the issue I am trying to address, how to write the script needed to compensate for the varying dates when an initial date is place in field 1 and auto-populating the following date fields with a standard 30 day spread.

Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.10 -
Copyright ©2001-2017 Web Wiz Ltd. -