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$
2
  • $\begingroup$ Cloud is now on 11.3 and CloudEvaluate does confirm this. $\endgroup$
    – Kuba
    Mar 12, 2018 at 11:44
  • 2
    $\begingroup$ Confirmed bug: CASE:4028568. $\endgroup$ Mar 13, 2018 at 8:03

1 Answer 1

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 and acknowledge that you have read and understand our privacy policy and code of conduct.

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