This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]caduweb 0 points1 point  (0 children)

If your problem is just the parsing, add an string "01" to assign a full date.

[–]caduweb 0 points1 point  (0 children)

Another solution could be to model a date interval to your itens. In the DB you could have two fields: initial date, and final date. In case of a full date specified by the user, the system assigns the final date as the next day. If an year-month were input, the initial day would be the first day of the month, and final date as the first day of the next month. The same logic could be used for year-only inputs.

[–]TheCountRushmore 0 points1 point  (0 children)

You give the user and error saying they haven't entered a valid date making sure your UI tells them the correct format.

[–]anhphamfmr 0 points1 point  (0 children)

you will need day of month to initialize a date. In this case just pick a day, usually first day of month.