module HexaPDF::DictionaryFields::DateConverter

Converter module for handling PDF date fields since they are stored as strings.

The ISO PDF specification differs from Adobe’s specification in respect to the supported date format. When converting from a date string to a Time object, this is taken into account.

See: PDF2.0 s7.9.4, ADB1.7 3.8.3

Public Class Methods


A date field may contain a string in PDF format, or a Time, Date or DateTime object.

convert(str, _type, _document)

Checks if the given object is a string and converts into a Time object if possible. Otherwise returns nil.

This method takes some forms of mangled date strings into account that were found in the wild.


This converter is usable if the type is PDFDate.