10
$\begingroup$

Bug introduced in 11.3 and fixed in 12.0.

CASE:4028568


DateRange[DateObject[{2018, 1, 1}, TimeObject[{0, 0, 0}]], 
          DateObject[{2018, 1, 1}, TimeObject[{4, 0, 0}]], {1, "Hours"}]

returns:

11.3

{DateObject[{2018, 1, 1, 0, 0, 0.}, "Instant", "Gregorian", 0.], 
 DateObject[{2018, 1, 1, 1, 0, 0.}, "Instant", "Gregorian", 0.], 
 DateObject[{2018, 1, 1, 2, 0, 0.}, "Instant", "Gregorian", 0.], 
 DateObject[{2018, 1, 1, 3, 0, 0.}, "Instant", "Gregorian", 0.]}

11.2

{DateObject[{2018, 1, 1, 0, 0, 0.}, "Instant", "Gregorian", 0.], 
 DateObject[{2018, 1, 1, 1, 0, 0.}, "Instant", "Gregorian", 0.], 
 DateObject[{2018, 1, 1, 2, 0, 0.}, "Instant", "Gregorian", 0.], 
 DateObject[{2018, 1, 1, 3, 0, 0.}, "Instant", "Gregorian", 0.], 
 DateObject[{2018, 1, 1, 4, 0, 0.}, "Instant", "Gregorian", 0.]}

11.3 is missing the last entry compared to 11.2 - could anyone confirm ?

$\endgroup$
  • $\begingroup$ Cloud is now on 11.3 and CloudEvaluate does confirm this. $\endgroup$ – Kuba Mar 12 '18 at 11:44
  • 2
    $\begingroup$ Confirmed bug: CASE:4028568. $\endgroup$ – b.gates.you.know.what Mar 13 '18 at 8:03
9
$\begingroup$

Yes, this is indeed dropping the last element. One way around this behavior(at least until the issue is fixed) is to have the end-point of the range not be an "Instant" date(ie: drop the final 0 in the list):

    DateRange[DateObject[{2018, 1, 1}, TimeObject[{0, 0, 0}]], 
     DateObject[{2018, 1, 1}, TimeObject[{4, 0}]], {1, "Hours"}]

    {DateObject[{2018, 1, 1, 0, 0, 0.}, "Instant", "Gregorian", -5.], 

     DateObject[{2018, 1, 1, 1, 0, 0.}, "Instant", "Gregorian", -5.], 

     DateObject[{2018, 1, 1, 2, 0, 0.}, "Instant", "Gregorian", -5.], 

     DateObject[{2018, 1, 1, 3, 0, 0.}, "Instant", "Gregorian", -5.], 

     DateObject[{2018, 1, 1, 4, 0, 0.}, "Instant", "Gregorian", -5.]}
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.