Title: DateTime::__construct(): Failed to parse time string (raw)
Last modified: May 11, 2021

---

# DateTime::__construct(): Failed to parse time string (raw)

 *  Resolved [andrew.alba](https://wordpress.org/support/users/andrewalba/)
 * (@andrewalba)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/datetime__construct-failed-to-parse-time-string-raw-2/)
 * This has been reported multiple times and never formally resolved. You can view
   the various stack traces in previous ticket. Basically this is a warning that
   is being logged. Have not had issues with this breaking a page as it is wrapped
   in catch, but this will flood error log with the warning.
 * [https://wordpress.org/support/topic/datetime__construct-failed-to-parse-time-string-raw/](https://wordpress.org/support/topic/datetime__construct-failed-to-parse-time-string-raw/)
 * It is not something that is easy to step through, but was able to recreate by
   visiting a calendar event. Was able to step through from
    `wp-content/plugins/
   the-events-calendar/common/src/Tribe/Models/Post_Types/Base.php:to_post()` method.
   The **$filter** attribute defaults to _raw_ when no value is passed.
 * The **$filter** value in turn gets passed to the `get_properties()` which in 
   turn passes to the `build_properties()` method which is inherited by the
    _wp-
   content/plugins/the-events-calendar/src/Tribe/Models/Post\_Types/Event.php_. 
   If you look at _wp-content/plugins/the-events-calendar/src/Tribe/Models/Post\
   _Types/Event.php:116_ you will see the Date_Utils class is trying to validate
   the $filter, but is obviously expecting a date.
 * Believe you can resolve this issue by changing line 116 from
 * `if ( Dates::is_valid_date( $filter ) ) {`
 * to
 * `if ( $filter !== 'raw' && Dates::is_valid_date( $filter ) ) {`
 * Please review this and if acceptable, please add to the next update. Thank you.
    -  This topic was modified 5 years, 1 month ago by [andrew.alba](https://wordpress.org/support/users/andrewalba/).
    -  This topic was modified 5 years, 1 month ago by [andrew.alba](https://wordpress.org/support/users/andrewalba/).

The topic ‘DateTime::__construct(): Failed to parse time string (raw)’ is closed
to new replies.

 * ![](https://ps.w.org/the-events-calendar/assets/icon-256x256.gif?rev=2516440)
 * [The Events Calendar](https://wordpress.org/plugins/the-events-calendar/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/the-events-calendar/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/the-events-calendar/)
 * [Active Topics](https://wordpress.org/support/plugin/the-events-calendar/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/the-events-calendar/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/the-events-calendar/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [andrew.alba](https://wordpress.org/support/users/andrewalba/)
 * Last activity: [5 years, 1 month ago](https://wordpress.org/support/topic/datetime__construct-failed-to-parse-time-string-raw-2/)
 * Status: resolved