Skip to content

Commit

Permalink
fix(GenDoc) format date fields correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
joebordes committed Apr 17, 2023
1 parent 4504fb7 commit 201eda5
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion modules/evvtgendoc/compile.php
Expand Up @@ -368,7 +368,18 @@ function retrieve_from_db($marcador, $id, $module, $applyformat = true) {
if (strpos($marcador, ':')) {
$cadena = substr($cadena, 0, 19);
$dt = DateTime::createFromFormat((strpos($cadena, ' ') ? 'Y-m-d H:i:s' : 'Y-m-d'), $cadena);
$cadena = date($tokeninfo[1], $dt->getTimestamp());
switch ($tokeninfo[1]) {
case 'l':
require_once 'modules/cbtranslation/cbtranslation.php';
$cadena = cbtranslation::getDayOfWeekName($dt->format('N') % 7, OpenDocument::$compile_language);
break;
case 'F':
require_once 'modules/cbtranslation/cbtranslation.php';
$cadena = cbtranslation::getMonthName($dt->format('n')-1, OpenDocument::$compile_language);
break;
default:
$cadena = date($tokeninfo[1], $dt->getTimestamp());
}
} else {
$date = new DateTimeField($cadena);
$cadena = $date->getDisplayDate($current_user);
Expand Down

0 comments on commit 201eda5

Please sign in to comment.