update date logic to prevent timezone issues