The date API module supports time only dates, and allows them through validation (ie. fires no errors for input when it lacks date but includes time in dropdown or popup input). However, it does not actually store the value later-on for a node field for example, because evidently, time-only dates don't make sense in that case. I think they make sense for calendar dates, eg. a reoccuring event each Monday 2pm, however that does not mean that discarded values should pass validation in other cases.

To reproduce:

- use dropdowns or popup input method
- enter no date, but specify time
- notice no validation errors
- enter part of the date (day, month or year but not all of them)
- notice you get a validation error

How can we make sure that validation kicks in if the input to be provided does not make sense as time-only?

Comments

KarenS’s picture

The API allows time-only by design (as a start toward creating time-only fields in the future), but the Date field cannot use that yet. So the Date module, which can't do anything with a time-only value, needs to add some validation to this process that the input includes at least a year.

KarenS’s picture

Title: Time only dates don't always make sense » Add validation to mark time-only dates invalid in date fields

Changing the title.