Trying to Debug Twig in Views Template

Support MB Views Trying to Debug Twig in Views TemplateResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #45720
    Marcus PottsMarcus Potts
    Participant

    Hi

    Please can you tell what is wrong with this:

    {% if post.application_dob %}<div class="row"><label>Date of Birth</label><span>{{ post.application_dob | date( 'm/d/Y' ) }}</span></div>{% endif %}

    I keep getting:

    PHP Fatal error: Uncaught Exception: Failed to parse time string (19/06/2024) at position 0 (1): Unexpected character in /var/www/vhosts/dev.xxxxxxxxxxxx.co.uk/httpdocs/wp-content/plugins/meta-box-aio/vendor/elightup/twig/Twig/Extension/CoreExtension.php:519

    Thanks
    Marcus

    #45726
    PeterPeter
    Moderator

    Hello Marcus,

    If you use the Twig date() function, please save the date field value as timestamp and check the issue again. Following the documentation
    https://docs.metabox.io/fields/date/
    https://twig.symfony.com/doc/3.x/filters/date.html

    #45734
    Marcus PottsMarcus Potts
    Participant

    Thank you Peter, that fixed it!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.