Great tool. And it has some features.
I would recommend putting some script on the page to evaluate all date fields with jQuery and manipulate date fields specifically? If your string is in the format yyyy-MM-dd HH24:mm:ss.zzz UTC
like the value 2015-10-27 13:58:46.490 UTC
then you can parse it in JS with new Date('2015-10-27 13:58:46.490 UTC')
and call .toString()
on it to get the local time.
Then you can use the --window-status
argument with wkhtmltopdf to wait for a given status from your script having run. So let's say we pass in --window-status "Dates Manipulated"
into wkhtmltopdf. When your client-side script has completed manipulating the date fields to the local time you want, set window.status = 'Dates Manipulated'
and wkhtmltopdf will finish your document conversion.
Since you're rendering this on the server side, I presume you have access to the URL being set. Let's assume your page is something like http://www.example.com/page_renderer
and you put a query argument on the back like http://www.example.com/page_renderer?timzeone=America/Toronto. Now you can use that timezone in your Javascript function to convert to the specified timezone.
var localTime = moment.tz("2015-10-27 13:58:46.490 UTC", "America/Toronto");