Critical Error on website after converting datetime fields to timestamps

Support MB Views Critical Error on website after converting datetime fields to timestampsResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #36833
    Niko SNiko S
    Participant

    Hi,
    I have a nested cloneable group with dates, for which I have created a view.
    It was working fine until I activated the "save as timestamps" option and re-saved the related posts that use those fields.

    The posts don't show and I get the regular "Critical Error" WP error instead.
    I have enabled WP debug and logging but no error code is shown and the logs are empty.
    Also tried to recreate the view from scratch but no luck.

    When I remove the timestamp option and re-save the posts, it works fine again.
    (I prefer using timestamps though because it allows me to use i18n features.)

    What could be the reason?

    Here's a stripped-down version of the view code:

    {% set field = attribute( post, 'termin-modul' ) %}
    {% for clone in field %}
    
    {% set field = attribute( clone, 'termin-modul-daten' ) %}
    {% for clone in field %}
    	 {% set field = attribute( clone, 'termin-modul-datum-startzeit' ) %}
    {{ field | date( 'j. F Y' ) }}
    {% endfor %}
    
    {% endfor %}
    #36835
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Please add a property timestamp to format the date of a subfield date in a group.

    {{ field.timestamp | date( 'j. F Y' ) }}

    Refer to this topic https://support.metabox.io/topic/date-format-is-giving-error-mb-views-template/

    And please use different variable names (field, clone), don't just use one for more scopes.

    #36836
    Niko SNiko S
    Participant

    Thank you, it worked!

    Strange that it doesn't get populated that way when using the View field picker, but it's good to know for the future 🙂

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