• Resolved Seb

    (@ssamyn)


    Hi,

    When I try to export from Admin side with “View/Export ALL Data”, the date column is incomplete, the first letters are removed. I’ve tried PDF, Excel and CSV but the result is the same. The date format is in French. As an example:

    medi 18 mai 2019 instead of samedi 18 mai 2019

    The “sa” is missing. I’ve tried to remove some columns in “Column Visibility”, with only a few columns but the result is the same, the first two letters are always removed.

    Thanks for your help,

    Kind regards,

    Volunteer Sign Up Sheets: Version 4.4.0

    Volunteer Sign Up Sheets Customizer: Version 3.2.3

    Volunteer Sign Up Sheet Groups: Version 1.5.0

    WordPress: 5.2.19

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author DBAR Productions

    (@dbar-productions)

    Those tables of data on the admin side are all displayed using the jQuery datatables library: https://datatables.net/

    That plugin library also handles all the exporting and printing functions.

    However, I have to set up the tables with some javascript to define columns, and sort/search functions, etc. In order to makes the date columns sortable, I had to embed a hidden timestamp value for each data before the actual date in each cell, so that datatables can sort numerically. Otherwise, it can’t sort properly for each possible date format that various sites could be using.

    I create the timestamp using PHPs very simple, and usually very accurate, strtotime function, which parses a text date/time into a timestamp. I then had to add some code to extend the export function of datatables to strip off the first 45 characters from the date before printing/exporting, which should have removed the timestamp (always the same length) as well as the html span text that surrounds it.

    My best guess is that since you are including the day before the date in your site’s date format, that is somehow breaking the PHP strtotime function, and it’s outputting a null value, or a shorter value, somehow, that is then causing my function that removes the first 45 characters to strip out the first two letters of the date.

    So, there are a couple of ways you can help me verify if this is the case:

    1. First, use the inspect feature of your browser to inspect one of the dates in the date column so you can hopefully see the hidden span where the timestamp is. If you can, please copy the full HTML text from that column and paste it here (you might have to include it in a code block so that www.remarpro.com doesn’t try to interpret the HTML). Then I can see if there is something wrong with the timestamp output.
    2. Go to your WordPress general settings and change the date format to NOT include the spelled out day before the full date. Just use a more standard date format with only numerical day, month, and year. If you need to enter a custom format to get that kind of output. You can find the format characters you can use here: https://www.php.net/manual/en/datetime.format.php
      Try something “standard” like: d/m/Y or m/d/Y depending on if you prefer day or month first.
      After you change the format and save your settings, try the export again. Then we will know if it’s the format you were using (if it works), or something with French translation (if it still doesn’t work).
      My code saves the dates in the database in standard MySQL format, but translates them using your WordPress date settings whenever it shows them on the screen, and datatables uses what is shown on the screen.

    Please send me the results of #1, and then let me know what happens when you change date display formats, per #2. That will give me a place to start looking to see if there is a way to fix this. So far, after many years of this plugin being available, you’re the only one to report this issue.

    Thread Starter Seb

    (@ssamyn)

    Thanks for your reply !

    #1 If I use the inspect on a date, this is what I get:

    <span class="pta-sortdate">|</span><strong>samedi 18 mai 2019</strong>

    #2 The format I use is l j F Y. If I use m/d/Y everything is fine indeed.

    Plugin Author DBAR Productions

    (@dbar-productions)

    Yes, so for #1, it looks like the strtotime function is not creating a timestamp based on your displayed date format. I need to look at my code, but possibly I can retrieve the MySQL formatted date (numbers only) first and use that to create the hidden timestamp, instead of trying to create a timestamp from the already translated/formatted date.

    For #2, what happens if you use: j F Y
    without the “l” first?

    I’m wondering if it’s a French translation issue for strtotime, because we know it works if you use just number formats like m d Y

    I’ll be out for a few hours, but can look at this more later today.

    Plugin Author DBAR Productions

    (@dbar-productions)

    I didn’t hear back from you, so I’m marking this as resolved, assuming you are working with the changed date format.

    However, I just released version 4.4.2, in which I made the change on how that timestamp is calculated to allow datatables to sort the date properly, and hopefully not chop off the characters on export due to invalid timestamp. If you have a chance, try going back to your original date format and let me know if it works for you now with version 4.4.2

    Thread Starter Seb

    (@ssamyn)

    Hi !

    Sorry for the delay. I’ve updated the app and with my date format l j F Y everything is fine now, thanks !

    Regards,

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Uncomplete date when exporting from Admin side’ is closed to new replies.