Support

Home Forums Event Espresso Premium Date picker Format when entering events

Date picker Format when entering events

Posted: April 29, 2019 at 6:10 am

Viewing 15 reply threads


Kitka

April 29, 2019 at 6:10 am

I have read this (now closed) post from Jan 2018, and I have used this fix in my functions file, but I see another issue now. While the date is dd/mm/yy now, in my list of events they are displaying sorted by day then month (so for example 07/05/2019, 08/06/2019, 11/05/2019). Is there a way to sort this correctly?


Josh

  • Support Staff

April 29, 2019 at 6:45 am

May I ask which post did you get the code from?

Also, if you remove the code from your functions.php file, does the list of events go to the correct order? Is this happening on the front end event list, the admin event list, or both?


Kitka

April 29, 2019 at 11:22 pm

https://eventespresso.com/topic/date-picker-format-when-entering-events/


Kitka

April 29, 2019 at 11:28 pm

Oh, Good point. The sort order in the front end doesn’t seem to be related to that code in the functions file, so it must be something else. This is the page with the list of events. https://newsite.yhabush.org.au/activities/current-walks-program/
The sorting in the back end event list seems to work fine.


Tony

  • Support Staff

April 30, 2019 at 5:43 am

Can you please post a link to the thread you found or the code you are using so we know what that is doing?

What’s the full shortcode you are using to load the table view? The sort.js file included within our add-on isn’t loading, it looks like your theme is ordering the file with its own and that’s likely what is causing the sorting error as I don’t get that with our version.


Kitka

April 30, 2019 at 4:50 pm

Original thread with the same subject: https://eventespresso.com/topic/date-picker-format-when-entering-events/


Kitka

April 30, 2019 at 4:51 pm

shortcode in the page is:
[ESPRESSO_EVENTS_TABLE_TEMPLATE order_by=start_date category_filter=false show_venues=false footable=false]


Tony

  • Support Staff

May 1, 2019 at 6:37 am

Original thread with the same subject: https://eventespresso.com/topic/date-picker-format-when-entering-events/

Ok, so yeah yeah that code is completely unrelated to the event table.

shortcode in the page is:
[ESPRESSO_EVENTS_TABLE_TEMPLATE order_by=start_date category_filter=false show_venues=false footable=false]

Thank you.

So if you temporarily switch themes to a default theme such as twentyseventeen, do you see the same issue on the table view template?

You can switch themes without affecting your users using with the WP Health Check plugin and enabling troubleshotting mode, which disabled all plugins and switches to a default theme for the current users.

Or use the WP Theme Test Drive plugin to switch themes for the current admin.


Kitka

May 1, 2019 at 7:26 pm

OK, I have found this javascript on the template page that when I remove it the order is correct. I think this bit is just to add the ability for the user to change the sort order of columns. Can you identify the error in here?
<script language=”javascript”>
jQuery(document).ready( function ($) {
“use strict”;
$.fn.dataTable.moment( ‘DD MM YYYY’ );
$(‘#ee_filter_table’).DataTable( {
“searching”: true,
“paging”: true,
“order”: [[ 0, “asc” ]],
“columnDefs”: [{
“targets”: 4,
“orderable”: true
}],
“lengthMenu”: [[10, 25, 50, -1], [10, 25, 50, “All”]]
});
} );
</script>


Tony

  • Support Staff

May 2, 2019 at 7:07 am

No, because the problem is that you’re using a custom script (not the above) from the theme to sort the table and it looks like that script isn’t sorting the table correctly, apparently based on what the above is setting.

I’m guessing it is this line $.fn.dataTable.moment( ‘DD MM YYYY’ );

EE doesn’t use the date output in the column to sort the table so it doesn’t need to know the format, it uses the timestamp value set on the row – https://monosnap.com/file/Yuvxlho0B4PKtwllALjPvhAzYeBsxi


Kitka

May 7, 2019 at 1:12 am

Thanks Tony, is there any other script that would allow the columns to be sortable in the front end?


Tony

  • Support Staff

May 7, 2019 at 4:41 am

Removing footable=false from the shortcode you are using tells the table view template to load the default EE scripts which allow for sorting, however, that may conflict with your themes script and may be why the shortcode has it set currently.

So, if you remove the above does sorting work on that page?


Kitka

May 8, 2019 at 2:15 am

I tried removing that bit in the shortcode but unfortunately that didn’t fix the sorting. It still sorts by the day first and not by the year/month first.


Tony

  • Support Staff

May 8, 2019 at 4:02 am

Yeah so most likely your theme’s script is still conflicting.

If you switch to a default theme such as twentyseventeen and view the table view template, does it work then?

I posted detaisl on how you can do that without disrupting your visitors in a reply above.


Kitka

May 8, 2019 at 10:39 pm

Yes it works OK in the default theme. I didn’t build this custom theme so I will have to try and find out what is causing the conflict.


Tony

  • Support Staff

May 9, 2019 at 4:12 am

It’s the sorting.js file in /yhabushwalking/js/sorting.js

You’ll need to de-enqueue that script on that specific page for the EE table to work, I don’t recommend removing if completely from the site as other pages may be using it.

Viewing 15 reply threads

The support post ‘Date picker Format when entering events’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso