WordPress.org

Ready to get started?Download WordPress

Forums

WP JQuery Timelinr
Supporting dd/mm/yy (4 posts)

  1. pzh20
    Member
    Posted 1 year ago #

    I'm trying to add the day to the date field within Timelinr as the non WP version supports.

    I have managed to update some of the code, but am having real problems with the date picker. It always seems to return NaN

    I know this is way outside normal support, but can you help?

    Many thanks
    Pete

    http://wordpress.org/extend/plugins/wp-jquery-timelinr/

  2. pzh20
    Member
    Posted 1 year ago #

    I fixed it.

    I will try and document the changes I've made and send it back to you. You may want to use it.

    Regards
    Pete

  3. xbytes
    Member
    Posted 6 months ago #

    Hello pzh2, would you be as kind as to share the changes to support this functionality? thanks in advance!

  4. pzh20
    Member
    Posted 6 months ago #

    I replace lines 234-235 of wp_jquery_timelinr.php with

    $currentDate = (substr($custom["timelineDate"][0], 0, 4) != "") ? substr($custom["timelineDate"][0], 0, 4) : "1900-";
    $currentDate .= (substr($custom["timelineDate"][0], 4, 2) != "") ? "-".substr($custom["timelineDate"][0], 4, 2) : "-01";
    $currentDate .= (substr($custom["timelineDate"][0], 6, 2) != "") ? "-".substr($custom["timelineDate"][0], 6, 2) : "-01";

    then lines 243-254 with
    day = dateParts[2] != undefined ? dateParts[2] : '01', month = dateParts[1] != undefined ? dateParts[1] -1 : '01', year = dateParts[0] //alert (day); //alert (month); //alert (year); jQuery('#timelineDate').val(jQuery.datepicker.formatDate('yy-mm-dd', new Date(year, month, day)));

    and lines 258-259 with
    list($year, $month, $day) = explode('-', $_POST["timelineDate"]); update_post_meta($post->ID, "timelineDate", $year.$month.$day);

    finally lines 294 and 295 with
    $date = (substr($custom["timelineDate"][0], 0, 4) != "") ? substr($custom["timelineDate"][0], 0, 4) : "1900"; $date .= (substr($custom["timelineDate"][0], 4, 2) != "") ? "-".substr($custom["timelineDate"][0], 4, 2) : "-01"; $date .= (substr($custom["timelineDate"][0], 6, 2) != "") ? "-".substr($custom["timelineDate"][0], 6, 2) : "-01";

    This worked for me.

    Regards
    Pete

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.