declare Date type and helper functions to make things cleaner