XF 1.5 Preformat custom user field

abdfahim

Well-known member
I have a textbox custom user field to store date (as XF doesn't have any date field yet).

I use regex to force the input in the form of any of the following
  1. 2017-07-05
  2. 2017-7-5
  3. 05 Jul 2017
  4. 5 Jul 2017

However, I would like to store it always in the form of option 1 ("2017-07-05"). One way is to use regex to allow option 1 only, but it would impose an extra restriction to an already annoying practice (not using a calendar).

So, is there any way I can format the user input before saving it to my database?
 
Back
Top Bottom