Make SimpleQueryEngine sort Dates correctly

Fixes #17068.

(cherry picked from commit 682f5d0dfeb4833842d476e6d8da946f6eb97e0f)

Conflicts:
	store/util/SimpleQueryEngine.js
	tests/store/Memory.js