Search code examples
opentbs

OpenTBS - Problem with frm and dates 01-01-1970 to 19-01-2038


I am using OpenTBS 3.10.1. In my docx file I have it as below:

[expiryDate;frm=’dd/mm/yyyy’] - [expiryDate]

which is unfortunately on my windows localhost displayed as:

01/01/1970 - 2039-09-10

Is problem with frm in openTBS fixed in newer versioin 3.11? If not what will be suggested workaround.

Thank you.

Edit 12/08/2020

PHP value (print_r) for one of the record I am merging is e.g. [expiryDate] => 2039-09-10. Date is ok when marge without 'frm' as in my original post.

In my documentGenerate.php it is realised by:

// due to a bug in TBS (not using one block of alias twice) aliases with consecutive numbers are added
foreach ($policies as $policeKey => $police) {$TBS->MergeBlock($policeKey . ',' . $policeKey . '2,' . $policeKey. '3,' . $policeKey . '4', $police);}

Then in my .docx it is as:

[TerLifIns2.expiryDate;frm='dd/mm/yyyy']


Solution

  • This bug can happen with 32-bit version of PHP for dates that are over « 2038-01-19 03:14:07 ».

    This bug is due to the technical limitation of timestamp in 32-bit version of PHP.

    This bug should be fixed on TBS version 3.12.1, which should be released before 2020-10-25.

    Note that you can have a 32-bit PHP on a 64-bit computer.

    More details on this PHP problem: https://ourcodeworld.com/articles/read/600/what-is-the-php-year-2038-y2k38-bug-and-how-to-solve-it