extracted some date utility functions in separate class