Error when register a new user and the form contain date field

Hi everyone,

I created a new project that allow users to regsiter a new account. the form contant a date filed, when submiting the form an error message aooears that there is an issue parsing the date data.
Note: I enable email activation feature.

I changed the Register.en-US.php template line 13 from this:

<p><?= $field->caption ?>: <?= $field->value ?></p>

to this:

 <p>
        <?= $field->caption ?>:
        <?php
        if ($field->value instanceof DateTime) {
            echo $field->value->format('Y-m-d H:i:s');
        } else {
            echo htmlspecialchars((string)$field->value);
        }
        ?>
    </p>

So, the issue solved. I suggest PHPMaker update the original template.

The sample Register.en-US.php template is only a simple example. It is exactly there for customizing the content and converting the database values to what you want to show in the email.

1 Like