Support » Plugin: TablePress - Tables in WordPress made easy » Sorting by date does not recognise year

  • Resolved cecilg

    (@cecilg)


    Hi Tobias,

    Sorry to hassle you again so soon with another question!

    I use the row_order sort shortcode to sort a list of events into date order with the sort date in US format in a hidden column. I do all the date conversions in an excel sheet which I then import with all the table data.

    ie – row_order=sort row_order_sort_column=E row_order_sort_direction=ASC hide_columns=5

    This has worked perfectly well with dates where yyyy =2019. When I included dates for events in Jan Feb 2020, ie yyyy=2020, these cells were placed first at the top of the list, as if they were dates in 2019. When I just changed the dates in the sort column to dates at the end of 2019, 12/25/2019 and 12/31/2019 the cells were sorted in the right order. It seems as if the year is not being used?

    Am I missing something here perhaps?

    Appreciate your help as always,

    Many thanks,

    Cecil

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    The cause for this is that the TablePress Row Order Extension (i.e. the row_order=sort and related Shortcode parameters) don’t understand dates. Thus, they actually sorted your dates as strings/text. This works with the mm/dd/yyyy format, as long as the yyyy (the year) part is the same as you noticed. If you want this to work for other years as well, you’d need to use a format like yyyy-mm-dd. Would that be a possibility in your case? Given that you are using this in a hidden column, it should work, right?

    Regards,
    Tobias

    Thread Starter cecilg

    (@cecilg)

    Hi Tobias,

    Again, many thanks for the amazingly quick response…

    Makes perfect sense and indeed, not a problem for me to change. I have just in fact done this and it works as perfectly.

    Really appreciate your support.

    Best wishes and enjoy the weekend,

    Cecil

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! 🙂 Good to hear that this helped!

    Best wishes,
    Tobias

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Sorting by date does not recognise year’ is closed to new replies.