Date field, how can i limit a value up to 30 days?

Date field, how can i limit a value up to 30 days?

When i enter a date, how can i set limitation til 30 days?

The date purchase will not exceed to 30 days, if exceed, it will pop a alert?

I just need the If Statement for this, hope you guys can help me