Yet another date formatting question

Home Forums Calendar Products Events Calendar PRO Yet another date formatting question

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #127375
    suncoastpca
    Participant

    Hello,

    I think I’ve been through just about every thread I can find, and I’m aware that the plugin takes its date formatting settings from WP’s Admin settings, but there are 2 places where I would like to change the format:

    1. In calendar month view, in the Tribe Bar, there’s an “Events In” field that always displays Y-m. I’d love to be able to change this to m-Y.

    2. In the admin UI when adding or editing an event, the Start Date & Time and End Date & Time fields are always Y-m-d.

    Any suggestions?
    –Paul

    #127764
    Barry
    Member

    Hmm, well the first is probably easier to change than the second – however both I would say are, at this time, advanced customizations. We’re certainly open to feature requests for inclusion in future releases, though, if you’d like to post one 🙂

    #127805
    suncoastpca
    Participant

    Thanks, Barry.

    Advanced customizations? That’s OK, I’m an advanced user. 🙂 I’ll post the feature request, but can you maybe point me in the right direction? I don’t need detailed instructions – I just had trouble tracking down where in the code these things are implemented. (I’m sure I’ll figure it out eventually, but I’m just hoping to save some time).

    #128275
    Barry
    Member

    Sure. Well with regards to the datepicker in the Tribe Bar first of all, the format is defined using the following piece of code which lives in resources/tribe-events-bar.js around lines 77-80, or thereabouts (of course normally the minified version of that code is used):

    td.datepicker_opts = {
        format: 'yyyy-mm-dd',
        autoclose: true
    };

    We don’t recommend editing core code and so, ideally, you’d need to override this by some other means. In the admin UI you would need to look for something similar in events-admin.js. Besides the Javascript, you’d probably want to make some changes at PHP level – for example to format the date correctly when the page initially loads and for the front end you’ll probably be interested in setting up a filter using the tribe-events-bar-date-search-default-value hook.

    Good luck!

    #128289
    suncoastpca
    Participant

    Perfect! Exactly what I was looking for. I hope to have some time to mess with this over the weekend. Thanks very much for the help.

    #135024
    Barry
    Member

    Happy to help 🙂

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Yet another date formatting question’ is closed to new replies.