Does anyone have a date auto-completer class?

I have a text field. I would like it to autocomplete to the system’s short date format.

So, for example, today is 23 July. If I type “2” into the field I want it to say “23/07/2015”. Then, if I type “0” into the field, I want it to change to say “20/08/2015”. And so on.

I have written this myself, coping with US and UK date formats, different separators, and different year formats. It’s an absolute beast. I was wondering if anyone has another implementation of it I could use?



Forgot to mention: let’s say we were back in 2009, and the date field was “20/07/2009”, with the cursor after the second “/”. If I typed “1” I would want it to then be “20/07/2010”, rather than “20/07/1000” - i.e. put the ‘20’ in for me. My existing one does this already…