Show one instance of Smart Date on node display

Created on 28 August 2024, 3 months ago
Updated 9 September 2024, 2 months ago

Hi, thank you for your wonderful module.

Date Recur module now only works on PHP 8.1+, so added a new date field on my 300 film grants which have a opening date and deadline. Most events happen yearly at the same time (recurring).

Suddenly realize that the dates are showing twice: current and next year on the nodes.

Setup:

Please how do I only show one opening - closing date?

PS. Views work great, only 1 date, but do not want to use a block in the node, as date is important for metatag.

Most appreciated.

๐Ÿ’ฌ Support request
Status

Fixed

Version

4.1

Component

Documentation

Created by

๐Ÿ‡ซ๐Ÿ‡ทFrance liliplanet Cannes

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @liliplanet
  • ๐Ÿ‡ซ๐Ÿ‡ทFrance liliplanet Cannes
  • ๐Ÿ‡ซ๐Ÿ‡ทFrance liliplanet Cannes
  • ๐Ÿ‡จ๐Ÿ‡ฆCanada mandclu

    Which formatter are you using? Based on what you want, it sounds like you should be using the Recurring formatter.

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance liliplanet Cannes

    Thank you so much for your reply mandclu!

    Yes I tried the recurring formatter, but when you select recurring yearly, you don't get the start and end dates dates.

    It outputs 'Deadline Annually on the 12th of August, 11:51am' ... I just need 'Deadline 12 August - 1 September, 2024ยด

    This is what happens when you select recurring in and yearly in manage display.

    Most appreciate the ability to just output start - end dates please ๐ŸŒท

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance liliplanet Cannes

    Sorry to ask again, but any solution when recurring formatter yearly is selected, it does not rewrite the output, just want the dates please.

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance liliplanet Cannes

    Again my apologies, as this is holding back my project.

    Will there be the availability to show just start and end dates when recurring formater (yearly) is selected?

    Or should I just go back to date recur module?

    Most appreciate your response ๐ŸŒท

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada mandclu

    If you don't want the recurrence rule to to be output, you'll need to override the smart-date-recurring-formatter.html.twig template in your site them, and you can just remove these lines:

      {% if rule_text %}
      <div class="rule-text">{{ rule_text }}</div>
      {% endif %}
    
  • ๐Ÿ‡ซ๐Ÿ‡ทFrance liliplanet Cannes

    Thank you mandclu, I am still struggling with only to output only one start - end date as a format.

    I copied the template to my theme, then removed the following code:

      {% if rule_text %}
      <div class="rule-text">{{ rule_text }}</div>
      {% endif %}

    now nothing shows, no output at all.

    All I want is upcoming 'start date - end date' please.

    Guess it has something to do with the following, but which?

    {% if days_array %}{% set day = include('smart-date-recurring-comma-list.html.twig', {values: days_array}) %}{% endif %}
    {% trans %}{{ repeat }}{{ day_separator }}{{ day }}{{ month_separator }}{{ month }}{{ time_separator }}{{ time }}{{ limit_separator }}{{ limit }}{% endtrans %}

    Most appreciate your support.

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada mandclu

    Can you show me how you have the recurring formatter configured, in terms of upcoming instances to show, etc?

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance liliplanet Cannes

    Oh thank you so much for your response manclu!

    Set Up

    When I select 'annually, the output becomes:

    but want just the dates:

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada mandclu

    Try setting it to show one upcoming instance.

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance liliplanet Cannes

    Thank you manclu, setting it to 1 upcoming instance, outputs ๐Ÿ˜ณ:

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada mandclu

    If you only want the one instance, you may also find that enabling the option "Show next instance separately" gives you cleaner markup.

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance liliplanet Cannes

    Oh so appreciate your support, but I just need the 'start - end date' please, is that not possible please?

    Here is show next instance seperately:

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada mandclu

    If you implement the template override I mentioned in an earlier comment, that should leave you just the start to end date

  • Status changed to Fixed 2 months ago
  • ๐Ÿ‡ซ๐Ÿ‡ทFrance liliplanet Cannes

    It worked, thank you manclu!

    Steps:

    1. override smart-date-recurring-formatter.html.twig, remove:

      {% if rule_text %}
      <div class="rule-text">{{ rule_text }}</div>
      {% endif %}

    2. Manage display

    - upcoming instance 1
    - show next instance separately.

    Most appreciated manclu ๐ŸŒท

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024