yup.js Validate number field is larger than sibling, or nullable
问题 I'm using Yup.js to validate some form fields. I have two integer fields, Year Built & Year Renovated . Year Built is a required field, Year Renovated is not. Year renovated can be left blank, however if there is a value it should be larger than year built (for a renovation certainly must occur after the date it was built). I believe I need to use yup's ref() as well as yup's when() function. I've tried the following: let currentYear = new Date().getFullYear(); yup.object().shape({ yearBuilt