adding tests for date/format
refactoring date/format a bit for readability