• Hi Pete, i’m having a date format issue with your plugin. See my screenshots and explanation below.

    1. The date field shows the input as yyyy-mm-dd
    2. I select a date from the calendar picker.
    3. The date is input in a dd/mm/YYYY format.
    4. I press Okand then Update. The date is then changed to 01/01/1970 and the post is immediately archived.

    I use the d/m/Y date format in my WordPress settings.

    When I manually type in the date as YYYY/mm/dd it works.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter adamhomebase

    (@adamhomebase)

    Sorry that image isn’t very big. Try this: https://ibb.co/nf0pQk

    Plugin Author shawfactor

    (@shawfactor)

    really hard to debug this, only thing ti can think of is you have another plugin filtering $_POST

    This is the code that updartes the archive date here:

    $expiration = ! empty( $_POST[‘lh_archive_post_status-post_expires’] ) ? sanitize_text_field( $_POST[‘lh_archive_post_status-post_expires’] ) : false;

    if( $expiration ) {

    $expiration = date(“Y-m-d H:i:s”, strtotime($expiration));

    // Save the expiration
    update_post_meta( $post_id, ‘_lh_archive_post_status-post_expires’, $expiration );

    as you can see it is poretty simpole and not a lot can go worng (although something is)

    Also it works perfectly on my sites…

    Perhaps try disabling other plugins…

    Pete

    Plugin Author shawfactor

    (@shawfactor)

    could also be a filetr on sanitize_text_field or how your server escapes commas

    you could try

    sanitize_text_field( stripslashes($_POST[‘lh_archive_post_status-post_expires’] ))

    really stabbing in the dark here though

    Plugin Author shawfactor

    (@shawfactor)

    I am resolving this for good order. I will still be monitoring the thread

    Thread Starter adamhomebase

    (@adamhomebase)

    Ok thanks, sorry I haven’t had time to look at this again. If I can’t resolve it i’ll let you know ??

    Thread Starter adamhomebase

    (@adamhomebase)

    Hey Pete, I have remedied this issue for my particular situation. I’m still not sure where the problem lies but the following is what I have discovered.

    The jquery date/time picker inputs the date in my chosen local format dd-mm-yyyy (this is the date format in my wordpress settings) but the plugin was still expecting it as mm-dd-yy. Anything outside normal date ranges reverts to 1/1/1970.

    eg. I select 17 August from the date picker, the date is input as 17-08-2017 but the plugin is expecting 08-17-2017, upon saving the date is reverted to 1/1/1970 because you can’t have a 17th month.

    I remedied the issue by editing the jquery datepicker dateFormat in edit.js from ‘date_format’ to “mm-dd-yy”.

    • This reply was modified 7 years, 7 months ago by adamhomebase.
    Thread Starter adamhomebase

    (@adamhomebase)

    Also BTW your plugin zip file is missing the jquery ui-icon images;

    ui-icons_21759b_256x240.png
    ui-icons_333333_256x240.png
    ui-icons_999999_256x240.png
    ui-icons_cc0000_256x240.png

    Hello there @shawfactor
    I would like to note that this problem is still present. I can help debug it if needed, but I believe @adamhomebase provided a good explanation and solution already!

    Hope this can be fixed soon, thanks!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Issue with date format, defaulting to 1/1/1970’ is closed to new replies.