minor code refactor for pg datetime support