RFC9557
This module provides utilities for handling RFC9557 Date and Time data, including a data type, validator, Twig filter for internationalized dates, and model classes for date manipulation. It offers flexible validation modes and can be integrated by other modules needing RFC9557 compatibility.
Code for other modules to provide, or consume, RFC9557 Date and Time.
Provides:
- TypedData type,
- Validator,
- Twig filter for outputting IntlDateFormatter internationalized dates,
- Date Model classes for separating and manipulating the date parts,
- An enum of ICU CLDR Calendars,
- A helper class for manipulating the Locale string used by PHP.
This module can possibly be simplified if native PHP support is implemented.
Requirements & Installation
This module requires no modules outside of Drupal core. Installation as any normal module.
Use of Twig filter requires that the Intl PHP extension is installed.
Example usage
The tests provide examples of the model and utility classes, the Validator and the DataType. The Twig filter including using best pattern automation.
Validation
Validation provides two modes:
- RFC9557::MODE_STRICT will reject any mismatched offset with time zone
flagged as critical.
- RFC9557::MODE_NORMAL requires that the mismatch is resolved by the
implementing code.
Modules
Modules implementing RFC9557 Date data types or validation:
- Xdate an extensible date field, supporting all RFC9557 date parts