Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: {speedy:set_ttl} gives “Failed to parse time string” error

Status Resolved
Add-on / Version Speedy 1.7.0
Severity
EE Version 7.1.6 pro

University Communications

Dec 17, 2022

I tried using {speedy:set_ttl}{expiration_date}{/speedy:set_ttl} as the docs say that timestamps are acceptable, but it gives the following error:

DateTime::modify(): Failed to parse time string ({expiration_date}) at position 0 ({): Unexpected character
user/addons/speedy/mod.speedy.php, line 417

The code on line 417 is executing the !is_numeric conditional. I even tried hardcoding a number between the tags but it gives the same error.
Thank you!

#1

BoldMinded (Brian)

Dec 17, 2022

Sounds like {expiration_date} is not parsed, so Speedy is getting the actual value of “{expiration_date}”, not a numeric timestamp. Did you try putting in a numeric timestamp instead of the {expiration_date} variable to test it?

#2

BoldMinded (Brian)

Dec 17, 2022

I even tried hardcoding a number between the tags but it gives the same error.

Never mind, I didn’t fully read your comment. Can you please share more of your template code? I can’t diagnose this without more context. I also need to try to replicate locally what you’re doing.

#3

University Communications

Dec 17, 2022

Sure, here’s the part of the template that’s being cached:

{exp:speedy:fragment driver="file" key="frag"}
 {exp:channel:entries
  channel="news_releases|features|story"
  limit="1"
  show_future_entries="yes"
  dynamic="yes"
  require_entry="yes"
  status="Open|Draft"
  disable="member_data|pagination|category_fields"
 }

  {modules_feature-detail-hero}
  {modules_feature-detail-wysiwyg}

 {/exp:channel:entries}

 {modules_you-may-also-like}
 {modules_subscribe}
 {embed="embeds/_bottom"}
{/exp:speedy:fragment}

And the {modules_feature-detail-hero} partial has this code at the very top of the file containing the {speedy:set_ttl} tag:

{if "{entry_date format='%U'}" > "{current_time format='%U'}"}
 {speedy:set_ttl}{entry_date}{/speedy:set_ttl}
 <div class="alert alert-danger embargo" role="alert">
  <div class="container">
   TEST: {entry_date} | This is an <strong>EMBARGOED</strong> news release for distribution on {entry_date format="%F %d, %Y - %g:%i%a"} PST. Do not share or link to this page.
  </div>
 </div>
{/if}
#4

BoldMinded (Brian)

Dec 19, 2022

Due to the upcoming holidays it could be a week or two before I have time to dig into this.

#5

BoldMinded (Brian)

Dec 20, 2022

Did you try using this take outside of the partial and putting it directly into the entries tag?

#6

University Communications

Dec 21, 2022

Yes, I did try that as well. I’ll be out on holiday for two weeks as well fyi. Thanks!

#7

BoldMinded (Brian)

Dec 21, 2022

I forgot to update you yesterday but I think I have it fixed so I’ll post a build when I get a chance.

#8

BoldMinded (Brian)

Dec 23, 2022

Comment has been marked private.

#9

University Communications

Jan 05, 2023

Comment has been marked private.

#10

BoldMinded (Brian)

Jan 05, 2023

Comment has been marked private.

#11

University Communications

Jan 06, 2023

Comment has been marked private.

Login to reply