1

Datetime module, Drupal 8: I want to create a datetime field with year granularity. In Drupal 7, it was no problem. Now in Drupal 8, it isn't possible anymore. How can I create such a field without the Years Only module since it isn't safe? Can I write a theme function? If so, how do I do that?

Excerpt from the datetime.module:

/** * Defines the format that date and time should be stored in. */

const DATETIME_DATETIME_STORAGE_FORMAT = 'Y-m-d\TH:i:s';

/** * Defines the format that dates should be stored in. */

const DATETIME_DATE_STORAGE_FORMAT = 'Y-m-d';

1 Answers1

2

This module is used to collect year part of date in any field. It provides a custom field type Year Only in the field UI.

With the help of this module one can add field where he/she wants to get year only instead of complete date.

https://www.drupal.org/project/yearonly

Latest release on 24 October 2017, right after 2 days you post this question. So, it's not cover by Drupal.

Hope it's help

Alan Yong
  • 993
  • 2
  • 12
  • 25