Date format in this week widget

Home Forums Calendar Products Events Calendar PRO Date format in this week widget

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1315451
    Jonas Lindén
    Participant

    This week widget is showing events with: day of the week + date.
    However the date is formatted in english. So for me it’s showing Day of the week in Swedish but it’s then showing the date as 3rd, 4th etc. instead of translating this to the swedish version for every version is it possible to change format to (F j)?
    So it would just show Month and a number.

    #1316000
    Barry
    Member

    Hi Jonas,

    Thanks for highlighting this: the dates are not currently translated (but of course they should be) – in fact, I’m surprised the days show correctly for you.

    We do have hooks to modify them, though, and if you want to alter the date format you could use something like this (and add it to your theme’s functions.php file or to a custom plugin):

    add_filter( 'tribe_events_this_week_date_format', function() {
        return 'F j';
    } );
    

    Does that help in the interim?

    #1316001
    Barry
    Member

    Hi again Jonas,

    On further review, I’m mistaken: we do pass the dates through WordPress’s internationally-friendly date formatting function. With that in mind, is it possible the core WP translation for Swedish is lacking some translations?

    #1316704
    Jonas Lindén
    Participant

    Hello,

    As far as I can see everything else is working ok in the Swedish version of WordPress.
    I’ve even tried changing the date format in wordpress but it doesn’t affect the event list.

     
     
    Med vänlig hälsning
     

    #1317038
    Barry
    Member

    Interesting. Here’s what I see if I switch my site to use Swedish (se_SV) in respect of the This Week widget:

    So far as I can see, the day names are translated as expected. Am I misunderstanding the problem in some way, perhaps? Or do you have any language-specific plugins (such as WPML) or anything comparable where the configuration may be getting in the way of normal operation?

    #1318381
    Jonas Lindén
    Participant

    Hello, your picture shows my problem perfectly.
    The day of the week is in the correct language but not the date.
    1st, 2nd, 3rd is
    1:a, 2:a, 3:e in Swedish. But it would be ok to just switch it to a simple date as in 1, 2, 3 etc.
    Or 2017-07-10 or 170710.

    #1318660
    Barry
    Member

    Gotcha! Those are actually passed through WordPress’s own date localization helpers, so my hunch is the problem lies there rather than directly with our own plugin code.

    Did you have a chance to try to approach I suggested previously (with the tribe_events_this_week_date_format code)?

    #1319343
    Jonas Lindén
    Participant

    Sorry Barry,

    You wrote two posts and the second one started with “I was mistaken…” so I never read the first one =)
    I added the changes to functions.php and that resolved my problem. Sorry for taking up more of your time and thanks for the help.

    #1319478
    Barry
    Member

    Not at all – I should have been clearer – glad you’re sorted in any case 🙂

    #1329507
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Date format in this week widget’ is closed to new replies.