I want to offer the user the possibility to introduce dates that are incomplete (for example just the year 2005, or Jan 1998) but also complete dates with year, month, day.
Well, if you used a date field then you should expect those 0s. One way you can get rid of them is by using the varchar
selection rather. However, it is better to use a date field since thats what is stored there.
If you have to allow users to enter an incomplete date then it has to be a varchar
and in that case you can format the input with your script and store in that column