I want users to specify a date, which may or may not include day and month (but will have at least a year.) The problem is that it is stored as a date-time in the database; the missing day / month will be saved as the default values โโand I will lose the original format and date value.
My idea was to save the actual format in the column as a row in addition to the datetime column. Then I could use a string column when I need to display the date and date-time for everything else. The drawback is that there is an additional column for each date column in the table that I want to display, and printing localized dates will not be so easy, since I cannot rely on the datetime value ... I will probably have to parse the row.
I hope I missed something, and it might be easier.
(Note. I use Rails if this is important for the solution.)
source
share