validate dates, at client and server side