fix dates, add tests, export the normalizeKey function