refactor date functions into date class