Fixed crash related to 0 length previous array.
Added DateTools.