<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Dynamic GIF Countdown based on Date Picker field in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Dynamic-GIF-Countdown-based-on-Date-Picker-field/m-p/1035892#M40540</link>
    <description>&lt;P&gt;I found out something strange.&lt;/P&gt;&lt;P&gt;I don't know why, but even if&amp;nbsp;contact.bday_date_comunication is a date picker field, once I call it from html and I use |pprint to print its type, it outputs (string). But the split function does not work. Don't know what else I could try.&lt;/P&gt;</description>
    <pubDate>Tue, 03 Sep 2024 16:00:45 GMT</pubDate>
    <dc:creator>PTata</dc:creator>
    <dc:date>2024-09-03T16:00:45Z</dc:date>
    <item>
      <title>Dynamic GIF Countdown based on Date Picker field</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Dynamic-GIF-Countdown-based-on-Date-Picker-field/m-p/1035235#M40513</link>
      <description>&lt;P&gt;I'm working on embedding an animated GIF into an email that displays a countdown timer. The static version works perfectly using the following HTML code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;p style="text-align:center"&amp;gt;
    &amp;lt;img style="background-color:#f8f9fa; border:hidden;" 
        src="https://www.py.it/countdown-to-2024-09-10.gif"
         alt="py" 
         rel="noreferrer" 
         width="40%"&amp;gt;
&amp;lt;/p&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This shows a countdown to September 10, 2024. However, I encountered a problem when trying to make the countdown dynamic based on a date picked from a date picker field linked to a contact’s birthday. The modified code is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;p style="text-align:center"&amp;gt;
    &amp;lt;img style="background-color:#f8f9fa; border:hidden;" 
        src="https://www.py.it/countdown-to-{{contact.birthday}}00:00:00.gif"
         alt="py" 
         rel="noreferrer" 
         width="40%"&amp;gt;
&amp;lt;/p&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The contact.birthday field outputs the date in the dd/MM/YY format (e.g., 10/09/24 for September 10, 2024), which doesn't work with the URL structure my GIF requires.&lt;/P&gt;&lt;P&gt;I've attempted several methods to format the date correctly, including:&lt;/P&gt;&lt;P&gt;{% set date_parts = contact.birthday.split('/') %}&lt;BR /&gt;{% set year_full = "20" + date_parts[2] %}&lt;BR /&gt;{% set new_date = year_full + "-" + date_parts[1] + "-" + date_parts[0] %}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And using filters like:&lt;/P&gt;&lt;P&gt;src="&lt;A href="https://www.py.it/countdown-to-" target="_blank"&gt;https://www.py.it/countdown-to-&lt;/A&gt;{{ contact.birthday|date('Y-m-d') }}00:00:00.gif"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;or:&lt;/P&gt;&lt;P&gt;src="&lt;A href="https://www.py.it/countdown-to-" target="_blank"&gt;https://www.py.it/countdown-to-&lt;/A&gt;{{ contact.birthday|dateformat('%d/%m/%Y', '%Y-%m-%dT%H:%M:%S') }}.gif"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;None of these attempts have been successful. I would appreciate any insights or suggestions on how to correctly format the date or alternative approaches to dynamically embed a countdown GIF based on a date field.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2024 12:24:19 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Dynamic-GIF-Countdown-based-on-Date-Picker-field/m-p/1035235#M40513</guid>
      <dc:creator>PTata</dc:creator>
      <dc:date>2024-09-02T12:24:19Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic GIF Countdown based on Date Picker field</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Dynamic-GIF-Countdown-based-on-Date-Picker-field/m-p/1035276#M40516</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/819598"&gt;@PTata&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The issue is how you have used the split filter. The correct syntax is &lt;STRONG&gt;{% set date_parts = module.date_field|split('/') %}&lt;/STRONG&gt;. Also even after fixing the filter, the current output is returning&lt;A href="https://prnt.sc/b7vmrAI6tR3V" target="_blank" rel="noopener"&gt; null values&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;I modified your code little bit and I think it is giving the &lt;A href="https://prnt.sc/BDmgDZfiTTgv" target="_blank" rel="noopener"&gt;correct output.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here is the modified code:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{% set date_parts = module.date_field|split('/') %}
{% set new_date =  date_parts[0] %}
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;{{ new_date }} You can directly call the date_parts but output contains [] brackets as its an array. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-sheets-root="1"&gt;I hope this will help you out. Please mark it as Solution &lt;STRONG&gt;Accepted and Upvote&lt;/STRONG&gt; to help another Community member. &lt;BR /&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2024 14:29:14 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Dynamic-GIF-Countdown-based-on-Date-Picker-field/m-p/1035276#M40516</guid>
      <dc:creator>GRajput</dc:creator>
      <dc:date>2024-09-02T14:29:14Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic GIF Countdown based on Date Picker field</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Dynamic-GIF-Countdown-based-on-Date-Picker-field/m-p/1035296#M40519</link>
      <description>&lt;P&gt;Hello, thank you for the response, but the problem persists.&lt;/P&gt;&lt;P&gt;When running the code:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{% set date_parts = contact.bday_date_comunication|split('/') %}
{% set new_date =  date_parts[0] %}  
    &amp;lt;p style="text-align:center"&amp;gt;
        &amp;lt;img style="background-color:#f8f9fa; border:hidden;" 
             src="https://www.py.it/countdown-to-{{ new_date }}00:00:00.gif" 
             alt="py" 
             rel="noreferrer" 
             width="40%"&amp;gt;
    &amp;lt;/p&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;The link that gets created is:&lt;BR /&gt;&lt;A href="https://www.py.it/countdown-to-12/09/2400:00:00.gif" target="_blank"&gt;https://www.py.it/countdown-to-12/09/2400:00:00.gif&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2024 14:57:42 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Dynamic-GIF-Countdown-based-on-Date-Picker-field/m-p/1035296#M40519</guid>
      <dc:creator>PTata</dc:creator>
      <dc:date>2024-09-02T14:57:42Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic GIF Countdown based on Date Picker field</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Dynamic-GIF-Countdown-based-on-Date-Picker-field/m-p/1035708#M40528</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/819598"&gt;@PTata&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-sheets-root="1"&gt;I tried this again with a date picker field and it is working fine. I'm unbale to replicate this issue. You are using a contact property, maybe it has something to do with it.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-sheets-root="1"&gt;I hope this will help you out. Please mark it as&lt;STRONG&gt; Solution Accepted and Upvote&lt;/STRONG&gt; to help another Community member.&lt;BR /&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2024 12:14:30 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Dynamic-GIF-Countdown-based-on-Date-Picker-field/m-p/1035708#M40528</guid>
      <dc:creator>GRajput</dc:creator>
      <dc:date>2024-09-03T12:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic GIF Countdown based on Date Picker field</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Dynamic-GIF-Countdown-based-on-Date-Picker-field/m-p/1035892#M40540</link>
      <description>&lt;P&gt;I found out something strange.&lt;/P&gt;&lt;P&gt;I don't know why, but even if&amp;nbsp;contact.bday_date_comunication is a date picker field, once I call it from html and I use |pprint to print its type, it outputs (string). But the split function does not work. Don't know what else I could try.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2024 16:00:45 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Dynamic-GIF-Countdown-based-on-Date-Picker-field/m-p/1035892#M40540</guid>
      <dc:creator>PTata</dc:creator>
      <dc:date>2024-09-03T16:00:45Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic GIF Countdown based on Date Picker field</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Dynamic-GIF-Countdown-based-on-Date-Picker-field/m-p/1036243#M40551</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/819598"&gt;@PTata&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Rather than a split filter, I would suggest a datetimeformat filter and set the format as per your need.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;|datetimeformat('%Y-%m-%d')&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I hope this will help you out. Please mark it as &lt;STRONG&gt;Solution Accepted and Upvote&lt;/STRONG&gt; to help another Community member. &lt;BR /&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2024 08:50:09 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Dynamic-GIF-Countdown-based-on-Date-Picker-field/m-p/1036243#M40551</guid>
      <dc:creator>GRajput</dc:creator>
      <dc:date>2024-09-04T08:50:09Z</dc:date>
    </item>
  </channel>
</rss>

