Time format for all Time fields

Support MB Views Time format for all Time fieldsResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #18723
    Trang NguyenTrang 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!

    #18727
    Long NguyenLong 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 NguyenTrang Nguyen
    Participant

    Thank a lot Long Nguyen! It works as charm!

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