• Resolved Metasequoia

    (@metasequoia)


    Hi,

    is it possible to change the way the date is being displayed in the calendar view?

    On my site with german language the date of an event looks like:

    Sep 23 um 10:00

    But it would be nice to see it like this:

    23. Sep. um 10:00 Uhr

    On the single events pages the date format is displayed correct except the “Uhr” suffix is missing.

    Any suggestions?

    Thanks!

Viewing 15 replies - 1 through 15 (of 16 total)
  • Hi,

    Your inquiry requires changes in the code, which unfortunately we cannot help with as part of our support. We’ll keep this topic open for a few days for other user to chime in if possible. Thanks for your understanding.

    Ben

    Thread Starter Metasequoia

    (@metasequoia)

    Hi Benjamin,

    thanks for your answer.

    Can you at least tell me which .php file contains the required code to change the date format?

    Is this something that is on the roadmap for a future release? Shouldn’t be to hard to implement and would be a huge benefit for international users.

    Thanks!

    -Martin

    Hi Martin,

    You can edit .twig files, located in public/themes-ai1ec/vortex/twig/. Or in a similar path for Extended views add-on, Posterboard and Stream.

    If you want to modify the php controllers you should look in app/view/calendar/view/ folder.

    If you only make changes in in twig, it is necessary to disable “Use frontend rendering” option(Events > Settings > Advanced).

    Hope this helps.

    Take care,
    Ben

    Hi!

    I also wanted to change the format and after a long search, I found the solution:

    – Open wp-content/plugins/all-in-one-event-calendar/app/view/event/time.php
    – In lines 177-182, the SHORT format is set. If you don’t want to use the short format anyway, just change it according to the PHP standard (https://php.net/manual/de/function.date.php). For the german format “1. Januar 2017” change it to this:

    public function get_short_date( Ai1ec_Date_Time $time, $add_year = false ) {
    		if ( $add_year ) {
    			return $time->format_i18n( 'j. F Y' );
    		}
    		return $time->format_i18n( 'j. F Y' );
    	}
    Thread Starter Metasequoia

    (@metasequoia)

    Hi Foxplex,

    this is great! Thanks for sharing your solution. Finally the date looks right.

    One more thing that bugs me: on whole day events AIC shows a “ganzt?gig” badge followed by the word “Uhr” which makes no sense in this context. Any idea how to deal with this issue?

    Thread Starter Metasequoia

    (@metasequoia)

    Ah, and do you know how to make the change in time.php persistent after a plugin update? Can I put this file in my child theme folder?

    Foxplex

    (@foxplex)

    Hi Metasequoia

    In my calendar, the word “Uhr” is not shown… so my date looks like this: “1. Januar 2017 um 13:00”. Do you know where this option can be edited?

    I tried creating a child theme (there are some tutorials around), but it got deleted after a plugin update… So I guess you have to copy the code every time.

    Thread Starter Metasequoia

    (@metasequoia)

    Hi Foxplex,

    funny, I dug through my own documentation and found that I added the “Uhr” by hand with this piece of css:

    .dt-duration::after, .ai1ec-event-time::after {
        content: " Uhr";
    }

    So, there is no option in the GUI to enable this and the downside of my solution is that it displays “Uhr” on all events including the all day events.

    Foxplex

    (@foxplex)

    What a creative solution ??
    But then, it’s not a big deal to hide the “Uhr” in allday events:

    
    .ai1ec-event-time::after {
        content: "Uhr";
    }
    
    .ai1ec-allday .ai1ec-event-time::after {
        display:none;
    }
    
    • This reply was modified 8 years ago by Foxplex.
    Thread Starter Metasequoia

    (@metasequoia)

    Sweet! I couldn’t find the right class to adress this case…

    But on the site I use the AIOC plugin I have an agenda widget view which lists all upcoming events (see here in right sidebar) In the popup that appears when hovering over an event the “Uhr” is still there on allday events.

    Any idea how to get rid of this?

    Foxplex

    (@foxplex)

    Try this:

    .ai1ec-popover-content .ai1ec-event-time::after {
    display: none;
    }
    

    Not sure if this also applies on not-allday events.

    Thread Starter Metasequoia

    (@metasequoia)

    Great – thanks a lot! The “Uhr” string is gone now, even on not-allday events (as you have guessed), but that doesn’t matter, because all events from this venue are all day.

    How did you find the .ai1ec-popover-content class? I didn’t see it in my webinspector. I think I can learn something new here…

    Foxplex

    (@foxplex)

    I just right-clicked the element (in this case, the word “Uhr”) and viewed it in the inspector (Element untersuchen). Then, I looked through the previous elements/divs…

    yeru

    (@yeru)

    Foxplex, thanks a lot for the get_short_date tweak! Works smoothly.

    I have one more question: The time still says “pm” and “am” as in English time format, but the connector betweet date an time is “um” as in German language.
    I looked for “um” and (independently) for “pm” in both the /calendar and /event folder – without succes.

    Can you tell me which part to tweak to get “Uhr” instead of “pm”/”am”?

    Foxplex

    (@foxplex)

    I don’t get what you want to change… as written above, we added “Uhr” (which is not a connector) as a :after element in CSS.

    If you want to change “um”, try looking into the language files.
    In general for such tweaks, I recommend downloading the whole calendar plugin directory and using Notepad++. This editor has a “Find in files” search function which makes it pretty easy to go through lots of files.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Change date format in calendar view’ is closed to new replies.