Support » Plugins and Hacks » [Resolved] End date is wrongly decoded

[Resolved] End date is wrongly decoded

  • The event end date is decoded wrongly.

    ESS_Import.php, line 919:
    $_POST['event_end_date'] = date( 'Y-m-d', strtotime( $date_start . ( ( $dur > 0 )? " + " . $dur ." seconds" : "" ) ) );
    replace with $_POST['event_end_date'] = date( 'Y-m-d', strtotime( $date_start . ( ( $dur > 0 )? " + " . $dur . " " . $date_[ 'unit' ] : "" ) ) );

    For time calculations the same should be done with line 923.


Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author essfeed


    it takes sense to use the ‘unit’ if it is provided within the feed.
    The point is that the ‘unit’ attribute is not mandatory in the ESS DTD for events that are not ‘recurrent’. So in almost all the cases ‘unit’ will be empty.

    I’ve placed a string estimation to use the ‘unit’ attribute for duration calculation if it is provided but if not, use the hard coded ‘seconds’ for the ‘strtotime’ calculation.

    Thanks for this report. Like your other reports, they all takes sense.

    In my case the feed looks like:

    <item type="standalone" unit="hour" priority="1">
    <name>Date: 2013-11-22T11:00:00 03:00</name>

    So, unit is a part of item parameters. It is IMHO reasonable to make it mandatory element of a dates/item xml type for standalone events as well.

    Besides that, ESS_Feed.php:120 hard-codes the default duration in hours:
    $duration_s = FeedValidator::getDateDiff( 'h', $event_start, $event_stop ); // number of seconds between two dates.

    I believe there are very few events that last less than one hour, not taking into account flashmobs and particle annihilations 🙂 Keep also in mind that the pludin itself doesn’t allow to schedule the event times up to seconds.

    Hotfix for 0.9.8:

    Date format is H-i-s, but it should be H:i:s. Strtotime doesn’t decode the time with dashes.


    Plugin Author essfeed


    Mmm, ok you’re right, this one is a real bug not an improvement.
    W’ve placed seconds as default unit because we live in a decimal world but in the events world hours takes more sense.
    I’m going to fix it in favor of ‘hour’ for every durations.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] End date is wrongly decoded’ is closed to new replies.