Skip to main content
Inspiring
September 9, 2025
Answered

Date Format Incorrect When Printing from SharePoint

  • September 9, 2025
  • 2 replies
  • 520 views

Exactly like it sounds. I have a document that auto-populates a date 33 days in the future when printed. (Thanks to this thread.) It populates correctly when opened in Acrobat Pro, but when printing directly from SharePoint, it prints today's date like so: 

Any ideas how to fix this?

 

This is the Will Print script: 

var d = new Date();

d.setDate(d.getDate()+33);
this.getField("FutureDate").value = util.printd ("dddd, mmmm d, yyyy", d);

Correct answer PDF Automation Station

I haven't tried it in Chrome because the company strongly prefers Edge, but I know some of my colleagues do use Chrome.


Remove the date formatting in the FutureDate field and it will work with Edge, Chrome, and Brave (I tested all 3).  Because the field is readonly, the formatting is not necessary.  There was a conflict with the custom date format you had in those web browsers.

2 replies

try67
Community Expert
Community Expert
September 9, 2025

As mentioned, non-Adobe viewers usually have very limited support for scripts. It's very odd it partially works, though. I would expect it to work entirely, or not at all... You can try a workaround, like this:

 

var days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
var dayOfWeek = days[d.getDay()];
this.getField("FutureDate").value = dayOfWeek + ", " + util.printd("mmmm d, yyyy", d);
Inspiring
September 10, 2025

Sadly, that did not fix it. 😞

 

I tried it both as a document script and document action with the same results.

 

I was really hoping there would be a solution that didn't involve hijacking my coworkers' computers to set Reader as the default app since Edge keeps changing my preferences back to opening in the browser (ugh).

PDF Automation Station
Community Expert
Community Expert
September 10, 2025

I tried your original Will Print script in the Edge web browser and it worked.  Can you upload the form?

PDF Automation Station
Community Expert
Community Expert
September 9, 2025

Non-Adobe PDF viewers and web browsers are limited in the scripts they support.