Skrol29 / opentbs

With OpenTBS you can merge OpenOffice - LibreOffice and Ms Office documents with PHP using the TinyButStrong template engine. Simple use OpenOffice - LibreOffice or Ms Office to edit your templates : DOCX, XLSX, PPTX, ODT, OSD, ODP and other formats. That is the Natural Template philosophy.
http://www.tinybutstrong.com/opentbs.php
70 stars 17 forks source link

Timezones supported? Nice would be the support of the DateTimeInterface #22

Open rotdrop opened 3 years ago

rotdrop commented 3 years ago

Is there support for time-zones for date-time formatting? Nice-to-have would also the support of the DateTimeInterface of PHP, which then would come with its builtin timezones.

Of course, I always can do $date->timeStamp(), but then: how do I pass the timezone to OpenTBS?

Thanks

rotdrop commented 3 years ago

A work-around, but "native" support would be nicer (need to check about the +/- with the offset):

 array_walk_recursive($this->backend->VarRef, function(&$value, $key) {
      if ($value instanceof \DateTimeInterface) {
        $stamp = $value->getTimestamp();
        $stamp -= $value->getOffset();
        $value = $stamp;
      }
    });