You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dates such as the PDF metadata's CreationDate have the general format "D:".
The datetime format strings in PDFDate.serialize() (included below) are correct for non-UTC: the timezone is shown as "+01'00'" or "-01'00'" for times ahead/behind of UTC.
However for UTC, the code in PDFDate.serialize() is given on line 318 of fpdf.syntax as f"D:{self.date:%Y%m%d%H%M%SZ%H'%M'}". This incorrectly takes the timestamp's hour and seconds as the timezone.
I think in this UTC case, the serialized date should either finish at the "Z", or have a timezone of "+00'00'". Printing "Z00'00'" for UTC looks wrong (I've only ever seen "Z" terminated strings", and printing "Z15:22" (my current time) looks very wrong indeed.
The incorrect line of fpdf.syntax is here:
classPDFDate:
...
defserialize(self, _security_handler=None, _obj_id=None):
ifself.with_tz:
assertself.date.tzinfoifself.date.tzinfo==timezone.utc:
out_str=f"D:{self.date:%Y%m%d%H%M%SZ%H'%M'}"# This should finish at 'Z' # out_str = f"D:{self.date:%Y%m%d%H%M%SZ}" # Instead finish at 'Z' like this # out_str = f"D:{self.date:%Y%m%d%H%M%S+00'00'}" # Or make UTC explicit with "+00'00'"else:
out_str=f"D:{self.date:%Y%m%d%H%M%S%z}"out_str=out_str[:-2] +"'"+out_str[-2:] +"'"else:
out_str=f"D:{self.date:%Y%m%d%H%M%S}"
The text was updated successfully, but these errors were encountered:
Dates such as the PDF metadata's CreationDate have the general format "D:".
The datetime format strings in
PDFDate.serialize()
(included below) are correct for non-UTC: the timezone is shown as "+01'00'" or "-01'00'" for times ahead/behind of UTC.However for UTC, the code in
PDFDate.serialize()
is given on line 318 offpdf.syntax
asf"D:{self.date:%Y%m%d%H%M%SZ%H'%M'}"
. This incorrectly takes the timestamp's hour and seconds as the timezone.I think in this UTC case, the serialized date should either finish at the "Z", or have a timezone of "+00'00'". Printing "Z00'00'" for UTC looks wrong (I've only ever seen "Z" terminated strings", and printing "Z15:22" (my current time) looks very wrong indeed.
The incorrect line of
fpdf.syntax
is here:The text was updated successfully, but these errors were encountered: