Date format is giving error MB views template
- This topic has 10 replies, 2 voices, and was last updated 2 years, 9 months ago by
Long Nguyen.
-
AuthorPosts
-
June 17, 2022 at 9:58 PM #36553
Gene Teigland
ParticipantHi,
I'm working with the MB views to create a template for the Event post type detail page, that I have created through Metabox post types.
On the event post type I have used custom fields for the date with datepicker option and time with timepicker option. Now while working with MB Views template, from the insert field if I do used the event date, For example like this -
{{ post.eventdate_options.event_starting_date | date( 'Y-m-d' ) }}or event time field {{ post.event_time.event_start_time | date( 'Y-m-d' ) }}
then the frontend stops working and it gives me this error -TypeError
twig_date_format_filter(): Argument #1 ($env) must be of type Twig\Environment, eLightUp\Twig\Environment given, called in /wp-content/plugins/meta-box-aio/vendor/elightup/twig/Twig/Environment.php(358) : eval()'d code on lineSo to resolve this here is what I have already tried-
1. Changing the date format.
2. Resetting the wordpress date format from general settings.
3. Selecting the timestamp and also the save format option from the date field options.But none of the above help me.
Please help me to get this error resolved.Thank you
June 18, 2022 at 9:33 PM #36570Long Nguyen
ModeratorHi,
Can you please share the code that creates the custom fields on your site? Some screenshots would be highly appreciated.
June 21, 2022 at 2:10 AM #36600Gene Teigland
ParticipantHi Long,
Here is the MB views code screenshot attached-
https://tinyurl.com/25r6ofhwHere is the custom fields with their settings-
https://tinyurl.com/223drruoEvent post type
https://tinyurl.com/27ovpj5fThank you
June 21, 2022 at 6:02 AM #36603Long Nguyen
ModeratorHi,
I got the issue. Please add a property
timestamp
to format the date of a subfielddate
in a group.{{ post.eventdate_options.event_starting_date.timestamp | date( 'Y-m-d' ) }}
I will also inform the development team to fix this issue in the next update.
June 21, 2022 at 9:16 PM #36614Gene Teigland
ParticipantI have used the above provided code but still getting same error.
Please check it once againtwig_date_format_filter(): Argument #1 ($env) must be of type Twig\Environment, eLightUp\Twig\Environment given, called in /wp-content/plugins/meta-box-aio/vendor/elightup/twig/Twig/Environment.php(358) : eval()'d code on line 58
June 22, 2022 at 12:33 PM #36627Long Nguyen
ModeratorHi,
Can you please clear the cache, remove other Views and deactivate all plugins except Meta Box, MB extensions then re-check this issue? See how it works on my site https://monosnap.com/file/zmlMxh6AO5CVMMPGzf2hL1VIQVhUA0
June 29, 2022 at 2:57 PM #36709Gene Teigland
ParticipantI did the same as you suggested but still getting the same error,
Please check the screenshot attached.June 29, 2022 at 3:08 PM #36710Gene Teigland
ParticipantHere are the steps we follow as suggested by you.
1. https://tinyurl.com/22tfnrr3
2. https://tinyurl.com/266o74hu
3. https://tinyurl.com/26nushac
4. https://tinyurl.com/247zaj9rPlease check it and let me know if any issue with the setting.
Thank you.June 29, 2022 at 9:25 PM #36719Long Nguyen
ModeratorHi,
Please share your site credentials via this contact form https://metabox.io/contact/
I will help you to investigate the issue.June 30, 2022 at 3:06 PM #36734Gene Teigland
ParticipantHi Support,
I have shared the website details through contact form.
Please check it and back to me.July 1, 2022 at 12:47 PM #36755Long Nguyen
ModeratorHi,
What I've done on your staging site:
- Deactivate all plugins except Meta Box, MB AIO, and switch to the standard theme of WordPress (Twenty TwentyTwo)
- Change the permalink settings to Post name (optional)Then the date format displayed as well on the front page, see screenshots
https://monosnap.com/file/d9JHelC3jETCu1yI61k8Vn9oJeT59v
https://monosnap.com/file/6HVqTWlR3VLaHnZIxQFEmZwlT3bBEACan you please confirm it works?
-
AuthorPosts
- You must be logged in to reply to this topic.