Improvement to item date guessing.

Also added some test utils.