Timezone IDs in PDFs - quality-manager/onboarding GitHub Wiki

Background

At times it is useful to think of PDFs as just another UI, not unlike the web UI, but it is also important to keep in mind how they differ. One such difference is timestamps (be they just a date or a precision stamp down to the nanosecond). We need to remember that the reader of a PDF does not have the same context that the reader of the web client has.

In particular:

  • PDFs are created on the server and therefore use the server's timezone when producing timestamps
  • PDFs created in one timezone could (and often are) shared with readers in another timezone

As a result, timestamps that do not specify a timezone are insufficient because users may lack the additional context to fill in the blanks. All timestamps in PDFs should contain a reference to the timezone that was assumed when producing that timestamp.

The Right Way

There's a utility class that you can use to help get this right: com.ibm.rqm.print.render.fop.xml.xslt.extension.TimeUtilsExtension. You'll most often want to use the method #formatMediumDateLongTime(). The "long time" nomenclature indicates that the resulting timestamp will contain a timezone ID.

<xsl:value-of select="$strings/Last_Modified"/>: <xsl:value-of select="time:formatMediumDateLongTime(alm:updated, $locale)"/>

Examples