I have a date picker box in a form. I want to allow them to pick or change the date. However, I want to default the current date ( today ) into the field and allow them to change it if they desire. To use the min/max for validation, what would be the validation string to check the pick date is not more than 2 days from today?
Check out momentjs, which is a great library for handling dates in BetterForms. It’s included by default in all apps.
For what you’re looking for, the
validator_calc might look something like this
moment(model.yourDate).isBefore(moment().add(2, 'days'), 'days')
or this might also work
moment(model.yourDate) < moment().add(2, 'days')