Automatically select the earlier of two dates

I want my form to have the user input two different dates, and then run some calculations based on whichever of those dates is earlier. I’ve got the calculation part down. Now I’m just trying to think how to get gravity to automatically select which of two date values is earlier, so I can feed that one into my calculation. Any ideas would be appreciated.