I found following fragment in code:

       if (!empty($settings['date_single_day']['end_after_midnight'])) {
         $start_time = $element['#value']['value']['time'];
         $end_time = $element['#value']['value2']['time'];
         if ($end_time < $start_time) {

This is resposnsible for adding one day to date. Unfortunately, this is behaving incorrectly. Variables $start_time and $end_time can be in 12 hours format (ie 06pm and 11am).

This code compares time lexically, not time-aware. In our example
'06pm' < '11am', while in 24 hour format it's identical to 18 < 11 which is obviously wrong. This makes "end after midnight" completely unusable.

I prepared patch for that issue, it solved problem for me.

CommentFileSizeAuthor
#2 end_after_midnight-2553653-2.patch961 bytesjsobiecki

Comments

harijari created an issue. See original summary.

jsobiecki’s picture

StatusFileSize
new961 bytes

Patch in attachment

jsobiecki’s picture

troybthompson’s picture

This solved problems I was having with it showing nodes spanning two days when I had a start time before noon. Thanks!

adarkling’s picture

strtotime conversion is the correct way to compare dates.

Patch applied properly.

RTBC

jgullstr’s picture

Status: Needs review » Fixed

Commited, thanks!

  • jgullstr committed 357fd80 on 7.x-2.x authored by harijari
    Issue #2553653 by harijari: End after midnight feature works incorrent...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

calefilm’s picture

Thank you, kindly, for the patch!