• Resolved sven.vervynckt

    (@svenvervynckt)


    Hi

    I installed Alexa CRM because we are creating a POC for a new project and are considering to use your tool as a portal solution.

    One thing we are struggling with is the dateformat in the Custom View Layout.
    I have put 2 tables. 1 with the simple View Shortcode and 1 with a custom layout:

    Table 1:

    [msdyncrm_twig]
    {% view entity=”vt_event_wod” name=”Planned Events” count=”10″ cache=”PT60M” %}{% endview %}
    [/msdyncrm_twig]

    Table 2: is with the custom layout. The problem is that the date is showing as a number in seconds and not as a readable date. See this page

    [msdyncrm_twig]
    {% view entity=”vt_event_wod” name=”Planned Events” count=”10″ cache=”PT60M” %}
    <table class=”table”>
    <thead class=””>
    <tr><th>Group Training</th><th>Start Time</th><th>End Time</th></tr>
    </thead>
    <tbody>

    {% for recordId, record in entityview.rows %}

    <tr>
    <td>{{ record[‘vt_group_trainingid’].value}}</td>
    <td>{{ record[‘vt_start_time’].value}}</td>
    <td>{{ record[‘vt_end_time’].value}}</td>
    <td>Book this training</td>

    </tr>
    {% endfor %}
    </tbody>
    </table>
    </div>
    {% endview %}
    [/msdyncrm_twig]

    I guess there is something simple we can do here to make the date format look like in the first table. I’ve checked the documentations but didn’t find anything to resolve my issue.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author alexacrm

    (@alexacrm)

    Hi @svenvervynckt

    to format date time you need to use twig date filter. In your case something like <td>{{ record['vt_start_time'] | date('d/m/Y') }}</td>. I would also recommend checking for null otherwise you’ll end up with today’s date.

    <td>{{ record['vt_start_time'] is empty ? "" : record['vt_start_time']|date("d/m/Y") }}</td>

    Thanks
    George
    PS. Watch for the quotes. Not sure if it’s a copy/paste issue but you’re using ‘’ where ” should be used.

    • This reply was modified 4 years, 6 months ago by alexacrm.
    • This reply was modified 4 years, 6 months ago by alexacrm.
    • This reply was modified 4 years, 6 months ago by alexacrm.
    • This reply was modified 4 years, 6 months ago by alexacrm.
    Thread Starter sven.vervynckt

    (@svenvervynckt)

    Thanks for the quick reply! I just had to add a .value and that worked perfectly!

    {% for recordId, record in entityview.rows %}
    
    <tr>
    <td>{{ record['vt_group_trainingid'].value}}</td>
    <td>{{ record['vt_start_time'] is empty ? "" : record['vt_start_time'].value | date("d/m/Y") }}</td>
    <td>{{ record['vt_end_time'] is empty ? "" : record['vt_end_time'].value | date("d/m/Y") }}</td>
    <td><a href="#">Book this training</a></td>
    </tr>
    {% endfor %}

    Kind regards
    Sven

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘DateFormat in Custom Layout View’ is closed to new replies.