Add leap_check helper method, #3007 related issue.