Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Are there any plans for storing partial date values, for example when a month or day are unknown, or optional?
Comments
Comment #2
mpdonadioThis may be covered by #2699895: Add settings to define #date_increment for datetime and datetime_range 'default' widgets, or potentially a duplicated
The problem is that a year-only or a year+month isn't really a date, as far as the internals are concerned. We can get around this by using Jan 1 or the first of the month to fake out the system. In my experience, though, the problem is that you still need to end up interpreting the data as year-only or a year+month, and run into problems.
That said, I have run into enough problems with this, that is something worthwhile to consider (though someone should feel free to work on a contrib solution with the idea that we could consider it for inclusion in core at some point).
Comment #3
jasloe CreditAttribution: jasloe commentedThanks for the clarification. From my own experience I can think of innumerable use cases that might benefit from partial date storage or where the currently implemented internals are too restrictive. Looks like a D7 contrib has fallen on the skids and I'll see about picking it back up or otherwise starting a new project.
https://www.drupal.org/project/partial_date
Looking at the following for inspiration and precedence.
https://github.com/bigfishtv/partial-date
https://github.com/58bits/partial-date
Comment #6
jhedstromMarking as duplicate of #2699895: Add settings to define #date_increment for datetime and datetime_range 'default' widgets, since that will allow partial dates to be collected.