function to check dates (#4). needs testing.