It’s possible to create a datetime field with a constant such as Y-m-dTH:i:s (date and time) or Y-m-d (date). I want to create a Y (year only) datetime field. To my great disappointment, this is no longer possible in Drupal 8. Do you have any idea how I can create such a field? I know the Years Only module but I don’t want to use it since it’s not safe. Is it possible to write a theme function for instance?
* Defines the format that date and time should be stored in.
const DATETIME_DATETIME_STORAGE_FORMAT = 'Y-m-dTH:i:s';
* Defines the format that dates should be stored in.
const DATETIME_DATE_STORAGE_FORMAT = 'Y-m-d';
(code excerpt from datetime.module)