# A possible bug with regard to DateObjects in Version 10?

Bug introduced in 10.0 and fixed in 10.1

Bug related to the Suggestion Bar Bug

While getting used to the new data type Date Object in Version 10 I noted that there seems to be a bug which on my machine (Windows 7) seems to be time-dependent, e.g. DateObject will cause an error after repeated use.

As an example all of a sudden a simple line like the following:

DateRange[DateObject[{2014, 1, 1}], DateObject[{2014, 12, 31}]]


Will return this error in Mathematica 10.0.1 :

Starting with a fresh notebook I observe the following:

The first call to DataRange will run without any error but after repeated application - note that I had to eventually abort the Table[ ... ] expression because it was not done after 5 minutes - the same statement will cause the error.

I also note that there seems to be tremendous overhead in using DateObject:

Has somebody else noted something similar and is this a known bug?

• Your code appears to work correctly here. Perhaps some resource (packlet) didn't load properly? – Mr.Wizard Oct 24 '14 at 10:32
• I have not loaded anything consciously besides starting Mma 10. Note, that the code (as shown) will work on my machine without any problems at first; the problem will arise after some time only. – gwr Oct 24 '14 at 11:11
• OK,I have reproduced it (OS X, v.10.0.1). It clearly seems to be related to the (already reported link) bug concerning the Suggestion Bar. Try to Minimize/Disable the bar and make the tests again ... This solution works for me. – SquareOne Oct 24 '14 at 13:02
• @Square1 Thank you, that seems to indeed resolve the issue which is a definite bug then. With regard to overhead it also seems to pays off to use DateList-form to generate a DateRanges and then Map DateObject to the result. – gwr Oct 24 '14 at 14:26
• The problem still persists in Version 10.0.2 - the suggestion bar needs to stay deactivated. – gwr Dec 12 '14 at 19:52

As kindly posted above by Square1 the error indeed is related to the Suggestion Bar Bug and will not appear if the Suggestion Bar is disabled in the preferences.

What I still find a slight nuisance is the overhead related to DateObject:

Table[ DateRange[DateObject[{2014, 1, 1}], DateObject[{2014, 12, 31}]], {1000}];
// AbsoluteTiming

(* {67.372854, Null} *)

DateObject /@ Table[ DateRange[ {2014, 1, 1}, {2014, 12, 31}], {1000}];
// AbsoluteTiming

(* {28.443627, Null} *)


Maybe I am missing something here, but I would expect the implementation to be smarter here?

• The performance gap still persists in 10.0.2 – gwr Dec 12 '14 at 19:54