Custom Fields
Re-Envisioned
Support MB Views Time format for all Time fields

  • Creator
    Topic
  • #18723
    Resolved Trang Nguyen
    Participant

    Hi,
    In MB Views, I want to set time format 1 time for all the Time fields output. I try this but it didn’t work:

    {% set time_format = 'H:i' %}
    {{ clone.hours_1 | date( '{{ time_format }}' ) }}
    {{ clone.hours_2 | date( '{{ time_format }}' ) }}

    As a newbie, I don’t know what is wrong. Please help!
    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #18727
    Long Nguyen
    Moderator

    Hi,

    For the cloneable field, you should use the for loop to display the value

    {% set time_format = 'H:i' %}
    {% for clone in post.field_id %}
        {{ clone | date( time_format ) }}
        <br>
    {% endfor %}

    Let me know how it goes.

    #18730
    Trang Nguyen
    Participant

    Thank a lot Long Nguyen! It works as charm!

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